Foxtable(狐表)用户栏目专家坐堂 → 请教狐表支持SQLite数据库吗?


  共有7411人关注过本帖树形打印复制链接

主题:请教狐表支持SQLite数据库吗?

帅哥哟,离线,有人找我吗?
fyqingshan
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:7 积分:154 威望:0 精华:0 注册:2011/6/19 11:51:00
请教狐表支持SQLite数据库吗?  发帖心情 Post By:2012/2/14 9:42:00 [只看该作者]

请教狐表支持SQLite数据库吗? 学狐表还需要学习vb语言吗?

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251048 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/2/14 9:45:00 [只看该作者]

1、支持Access\SQL Server\Oracle

2、不需要学习vb,学foxtable的帮助文件足矣。


 回到顶部
帅哥哟,离线,有人找我吗?
fyqingshan
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:7 积分:154 威望:0 精华:0 注册:2011/6/19 11:51:00
  发帖心情 Post By:2012/2/14 9:53:00 [只看该作者]

能把编程语言中文化更好呀

 回到顶部
帅哥哟,离线,有人找我吗?
hunanwl
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:447 积分:3759 威望:0 精华:0 注册:2012/12/9 8:52:00
  发帖心情 Post By:2013/9/11 14:18:00 [只看该作者]

那 我要怎么弄才能支持SQLite数据库呢,添加外部引用文件可以解决吗,狐爸帮忙想想办法啊

最好是可以动态的支持任何数据库就最好了
[此贴子已经被作者于2013-9-11 14:19:21编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2013/9/11 14:20:00 [只看该作者]

没有办法支持哦!

 回到顶部
帅哥哟,离线,有人找我吗?
逛逛
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:1693 积分:12117 威望:0 精华:7 注册:2013/7/11 10:52:00
  发帖心情 Post By:2013/9/11 15:43:00 [只看该作者]

以下是引用hunanwl在2013-9-11 14:18:00的发言:
那 我要怎么弄才能支持SQLite数据库呢,添加外部引用文件可以解决吗,狐爸帮忙想想办法啊

[此贴子已经被作者于2013-9-11 14:19:21编辑过]

添加System.Data.SQLite.dll


 回到顶部
帅哥哟,离线,有人找我吗?
hunanwl
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:447 积分:3759 威望:0 精华:0 注册:2012/12/9 8:52:00
  发帖心情 Post By:2013/9/11 16:35:00 [只看该作者]

已经添加了  接下来我该怎么连接SQLite数据库呢


 回到顶部
帅哥哟,离线,有人找我吗?
hunanwl
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:447 积分:3759 威望:0 精华:0 注册:2012/12/9 8:52:00
  发帖心情 Post By:2013/9/11 16:36:00 [只看该作者]

以下是引用逛逛在2013-9-11 15:43:00的发言:

添加System.Data.SQLite.dll

已经添加了 接下来我该怎么连接SQLite数据库呢


 回到顶部
帅哥哟,离线,有人找我吗?
逛逛
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:1693 积分:12117 威望:0 精华:7 注册:2013/7/11 10:52:00
  发帖心情 Post By:2013/9/11 16:56:00 [只看该作者]

三个基本操作:

1、新建数据库(自定义函数)

'传入1个参数,数据库全路径
Dim Path As String = Args(0)
Dim b As System.Data.SQLite.SQLiteException
'成功返回1,失败返回-1
If System.IO.File.Exists(Path) = True Then
    MessageBox.show("已有同名的数据库存在.")
    Return -1
End If
Using myData As New System.Data.SQLite.SQLiteConnection( "data source=" &  Path)
Try
    myData.Open()
    myData.Close()
    SaveConfigValue("目标数据库",Path )
    Return 1
Catch b
    Throw New System.Data.SQLite.SQLiteException(b.Message)
    Return -1
End Try
End Using

 

2、执行SQL(自定义函数)

'传入文本型,SQL语句,返回1,失败返回-1
Dim sql As String = Args(0)
Dim Path As String =  GetConfigValue("目标数据库", "无")  '我是将路径存放在这里,根据需要改
If Path = "无" Then
    MessageBox.show("请定位数据库.")
    Return Nothing
End If

'定义一个数据库连接,使用后立即释放
Using connection As New System.Data.Sqlite.SQLiteConnection("data source=" & Path)
Using cmd As New System.Data.Sqlite.SQLiteCommand(sql, connection)
Try
    connection.Open()
    cmd.ExecuteNonQuery()
    Return 1
Catch e As System.Data.Sqlite.SQLiteException
    connection.Close()
    Throw New System.Data.Sqlite.SQLiteException(e.Message)
    Return -1
End Try
End Using
End Using

 

3、取记录集(自定义函数)

'传入文本型,SQL语句,返回DataTable,失败返回Nothing
Dim sql As String = Args(0)
Dim Path As String =  GetConfigValue("目标数据库", "无")
If Path = "无" Then
    MessageBox.show("请定位数据库.")
    Return Nothing
End If
Using  connection As New System.Data.SQLite.SQLiteConnection("data source=" & Path)
Dim ds As New System.Data.DataSet()
Try
    connection.Open()
    Dim command As New System.Data.SQLite.SQLiteDataAdapter(sql, connection)
    command.Fill(ds, "ds")
    Return ds.Tables(0)
Catch ex As System.Data.SQLite.SQLiteException
    Throw New Exception(ex.Message)
    Return Nothing
End Try
End Using

 

 

 

不过,狐表的Access不需安装就可使用,没有必要用Sqlite


 回到顶部
帅哥哟,离线,有人找我吗?
hunanwl
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:447 积分:3759 威望:0 精华:0 注册:2012/12/9 8:52:00
  发帖心情 Post By:2013/9/11 17:27:00 [只看该作者]

以下是引用逛逛在2013-9-11 16:56:00的发言:

三个基本操作:

1、新建数据库(自定义函数)

'传入1个参数,数据库全路径
Dim Path As String = Args(0)
Dim b As System.Data.SQLite.SQLiteException
'成功返回1,失败返回-1
If System.IO.File.Exists(Path) = True Then
    MessageBox.show("已有同名的数据库存在.")
    Return -1
End If
Using myData As New System.Data.SQLite.SQLiteConnection( "data source=" &  Path)
Try
    myData.Open()
    myData.Close()
    SaveConfigValue("目标数据库",Path )
    Return 1
Catch b
    Throw New System.Data.SQLite.SQLiteException(b.Message)
    Return -1
End Try
End Using

 

2、执行SQL(自定义函数)

'传入文本型,SQL语句,返回1,失败返回-1
Dim sql As String = Args(0)
Dim Path As String =  GetConfigValue("目标数据库", "无")  '我是将路径存放在这里,根据需要改
If Path = "无" Then
    MessageBox.show("请定位数据库.")
    Return Nothing
End If

'定义一个数据库连接,使用后立即释放
Using connection As New System.Data.Sqlite.SQLiteConnection("data source=" & Path)
Using cmd As New System.Data.Sqlite.SQLiteCommand(sql, connection)
Try
    connection.Open()
    cmd.ExecuteNonQuery()
    Return 1
Catch e As System.Data.Sqlite.SQLiteException
    connection.Close()
    Throw New System.Data.Sqlite.SQLiteException(e.Message)
    Return -1
End Try
End Using
End Using

 

3、取记录集(自定义函数)

'传入文本型,SQL语句,返回DataTable,失败返回Nothing
Dim sql As String = Args(0)
Dim Path As String =  GetConfigValue("目标数据库", "无")
If Path = "无" Then
    MessageBox.show("请定位数据库.")
    Return Nothing
End If
Using  connection As New System.Data.SQLite.SQLiteConnection("data source=" & Path)
Dim ds As New System.Data.DataSet()
Try
    connection.Open()
    Dim command As New System.Data.SQLite.SQLiteDataAdapter(sql, connection)
    command.Fill(ds, "ds")
    Return ds.Tables(0)
Catch ex As System.Data.SQLite.SQLiteException
    Throw New Exception(ex.Message)
    Return Nothing
End Try
End Using

 

 

 

不过,狐表的Access不需安装就可使用,没有必要用Sqlite

还是一头雾水 呵呵

不是说Sqlite速度稳定性比Access好吗 网上说access到100M后速度下降好的


 回到顶部
总数 19 1 2 下一页