Hi,
im using the code below to create a dsn fron vb for a SQL Server databse...but im getting an error if i try to add a userid (using UID) to the attributes.....is this not the correct way for adding a userid?? is there another way to do this??
the error im getting is:
"Run time error 3146
ODBC call failed".
Thanx.
Code:Dim nRet As Long Dim sDriver As String Dim sAttributes As String sDriver = "SQL Server" sAttributes = "Server=my_server" & Chr$(0) sAttributes = sAttributes & "DSN=test" & Chr$(0) sAttributes = sAttributes & "DATABASE=test" & Chr$(0) sAttributes = sAttributes & "UID=test" & Chr$(0) 'sAttributes = sAttributes & "PWD=test" & Chr$(0) DBEngine.RegisterDatabase "test", "SQL Server", True, sAttributes nRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, sDriver, sAttributes)




Reply With Quote