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