Results 1 to 2 of 2

Thread: Creating a DSN........

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    Creating a DSN........

    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)

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    anyone??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width