如何设置Vb表单的数据源 [英] How Do I Set Data Source Of A Vb Form
问题描述
Hai朋友,
我已经在我的表格中连接数据库
这是实际路径数据库
D:\ RESOLVED \TSMS_1.0 \ DB.accdb
我提这样的数据库
con = 新 OleDbConnection( Provider = Microsoft.ACE.OLEDB.12.0;数据Source = DB.accdb)
实际问题是当我从表单更新数据库时,它会创建另一个访问文件(DB.accdb)在bin文件夹中。
当我重新启动表单时更新或未显示。
我需要更新单个数据库。
有人建议我这样使用
con = 新 OleDbConnection( Provider = Microsoft.ACE.OL EDB.12.0;数据源= Application.StartupPath& \ & youraccessfile name; Persist安全信息=真)
仍然在这条线上有错误。
< pre lang =text>错误:从字符串Provider = Microsoft.ACE.OLEDB.12转换。输入'Long'是无效的。
请帮我解决这个问题。
当我使用数据库文件格式为accdb时,问题仍然存在。
所以我将'accdb'转换为'mbd'
并使用,
Dim con = 新 OleDbConnection( Provider = Microsoft.Jet.OLEDB.4.0; Data Source =& Application.StartupPath& \DB.mdb)
现在它工作正常。
感谢所有支持的朋友。
Hai friends,
I have connected database in my form
This the actual path of the database
D:\RESOLVED\TSMS_1.0\DB.accdb
and i mention the database like this
con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=DB.accdb")
The actual problem is when i update the database from the form, it creates a another access file(DB.accdb) in the bin folder.
when i restart the form the updation or not shown.
I need to update single database.
Someone advice me to use like this
con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= Application.StartupPath &"\" &youraccessfile name;Persist Security Info=True")
Still am having error on this line.
Error: Conversion from string "Provider=Microsoft.ACE.OLEDB.12." to type 'Long' is not valid.
Please help me in this issue.
The problem still occurs while i am using database file format as "accdb".
So i convert 'accdb' to 'mbd'
and used,
Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\DB.mdb")
Now it works fine.
Thank you for all your supports friends.
这篇关于如何设置Vb表单的数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!