Access数据库改成SQL数据库,VB窗体里面的代码改了怎么不行
原Access数据库strConnection = "Provider=Microsoft.jet.oledb.4.0;Data Source=" & App.Path & "\Person.mdb"
改成SQL数据库strConnection = "Provider=Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=MIC"后说找不到程序
[解决办法]
please use the guide to generate the code and test it
[解决办法]
连接字符串不对
数据库在本机:
cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=zzgjcj;Data Source=."
数据库不在本机:
cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=数据库;Data Source=服务名;User ID=sa;Password=sa"
[解决办法]
(1)是否安装了SQL
(2)账户是否正确
可以使用VB的连接字符串对话框中的测试功能测试下。
[解决办法]
dim g_strDBConn as new adodb.connectionWith g_strDBConn If .State = adStateOpen Then .Close .ConnectionString = "driver=SQL Server;server=计算机名或IP地址;uid=sa;pwd=sa的密码;database=数据库名" .CommandTimeout = 0 .OpenEnd With