我在以前的帖子上看过类似的问题,往了在哪了,请老大们帮小弟改改小弟的程序Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal hwndParent As Long, ByVal fRequest As Long, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Long
Private Sub Form_Load()
nRet = SQLConfigDataSource(vbAPINull, ODBC_REMOVE_SYS_DSN, "SQL Server", "DSN=数据库名称")
    sAttributes = "Server = 1111 Chr$(0)
    sAttributes = sAttributes & "DESCRIPTION=说明" & Chr$(0)
    sAttributes = sAttributes & "DSN=111" & Chr$(0)
    sAttributes = sAttributes & "DATABASE=111"在这个地方UID = 111;PWD = 111 的时候出错    nRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_SYS_DSN, "SQL Server", sAttributes)
end sub我就是这么做的不加用户名和密码的时候可以添加DSN,还需要设别的吗???????