本文介绍了如何设置Vb表单的数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 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安全信息=真) 仍然在这条线上有错误。 错误:从字符串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 formThis the actual path of the databaseD:\RESOLVED\TSMS_1.0\DB.accdband i mention the database like thiscon = 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 thiscon = 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表单的数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 22:50
查看更多