返回首页

我的代码是根据

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)
请告诉我,我的错
预先感谢

回答

评论会员:游客 时间:2012/02/06
imgsrc=]应该帮助你
丽娜德赛:当我评论在UID放大器; PWD线创建DSN,但它不是受信任的连接
NBSP
NBSP。属性="服务器="放大器; SERVER_NAME放大器; CHR(0)

NBSP属性=属性放大器;的"DSN ="AMP dataname放大器;染色体( 0)

属性=属性放大器"数据库"AMP dataname放大器; CHR(0)
NBSP 属性=放大器属性;"Trusted_Connection = YES"放大器; CHR(0)

NBSP"属性=属性放大器"UID ="SA""放大器; CHR(0)
NBSP NBSP"属性=属性放大器; MIPL"PWD ='"&CHR(0)
NBSP NBSP"要显示对话框,使用,而不是对vbAPINull Form1.Hwnd
评论会员:。 时间:2012/02/06