DNS-Less ADO Connection

  • 15 years ago

    This problem was solved awhile back, so I'm editing the post with the solution.  The intial code I had was correct, it was a settings problem on the server end that was keeping me from connecting.  Anyway, the code looks like:

        Dim conRecordset As New ADODB.Connection
        Dim rsRecordSet As ADODB.Recordset
        Dim strSQL As String
        Dim bSuccess As Boolean
       
        'Simplified SQL for demonstration      
        strSQL = "SELECT [DocumentID], [FolderID], [StatusDate] FROM [View MailingPart]
        'Replace xx with your valid information
        conRecordset.Open ("Driver={SQL Server};Server=xx.xx.xx.xx;Database=xx;Uid=xx;Pwd=xx")
        Set rsRecordSet = New ADODB.Recordset
        rsRecordSet.CursorLocation = adUseClient
        rsRecordSet.Open strSQL, conRecordset
       
        'Code using the recordset here

        rsRecordSet.Close  
        conRecordset.Close

    Also, I found this site which has almost every connection string you could want.

    http://www.connectionstrings.com/

    -Tril

























Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An idiot with a computer is a faster, better idiot” - Rich Julius