如何为SQL Server 2008 R2创建dsn [英] how to create dsn for sql server 2008 r2
本文介绍了如何为SQL Server 2008 R2创建dsn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码与
相同
my code is as under
CMD.CommandText = "select @@SERVERNAME"
RS = CMD.Execute
servername = RS.Fields(0).Value
SERVER_NAME = RS.Fields(0).Value
Attributes = "SERVER=" & SERVER_NAME & Chr(0)
Attributes = Attributes & "DSN=" & dataname & Chr(0)
Attributes = Attributes & "DATABASE=" & dataname & Chr(0)
Attributes = Attributes & "Trusted_Connection=yes" & Chr(0)
'Attributes = Attributes & "uid='sa'" & Chr(0)
'Attributes = Attributes & "pwd='mipl'" & Chr(0)
'To show dialog, use Form1.Hwnd instead of vbAPINull.
MsgBox(Attributes)
intRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, Driver, Attributes)
请告诉我我的错误
在此先感谢
please tell me my mistake
thanks in advance
推荐答案
此 [
This[^] should help you out.
当我对uid进行评论时&已创建dsn的pwd线,但其不受信任的连接
属性="SERVER ="& SERVER_NAME& Chr(0)
属性=属性& "DSN ="&数据名称和Chr(0)
属性=属性& "DATABASE ="&数据名称和Chr(0)
属性=属性& "Trusted_Connection =是"& Chr(0)
''属性=属性& "uid =" sa"& Chr(0)
''属性=属性& "pwd =" mipl"& Chr(0)
"要显示对话框,请使用Form1.Hwnd而不是vbAPINull.
when i commented on uid & pwd line dsn created but its not trusted connection
Attributes = "SERVER=" & SERVER_NAME & Chr(0)
Attributes = Attributes & "DSN=" & dataname & Chr(0)
Attributes = Attributes & "DATABASE=" & dataname & Chr(0)
Attributes = Attributes & "Trusted_Connection=yes" & Chr(0)
''Attributes = Attributes & "uid=''sa''" & Chr(0)
''Attributes = Attributes & "pwd=''mipl''" & Chr(0)
''To show dialog, use Form1.Hwnd instead of vbAPINull.
这篇关于如何为SQL Server 2008 R2创建dsn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文