DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Code sample: connect to SQL2000 from VB6 app

  1. #1
    SCD Guest

    Code sample: connect to SQL2000 from VB6 app


    I am looking for a code sample of how to connect to SQL2000 from a VB6 app
    using ADO. The more info the better.
    Sincere thanks in advance.

  2. #2
    Craig Clearman Guest

    Re: Code sample: connect to SQL2000 from VB6 app

    Steve,

    >I am looking for a code sample of how to connect to SQL2000 from a VB6 app
    >using ADO.


    Dim conn As ADODB.Connection
    Dim rs As ADODB.Recordset

    Set conn = New ADODB.Connection
    conn.Open "Provider=SQLOLEDB.1;" & _
    "Initial Catalog=YourDatabase;" & _
    "Data Source=YourServer", _
    "YourUserID", _
    "YourPassword"
    Set rs = conn.Execute("SELECT * FROM WhateverTable")
    If Not rs Is Nothing Then
    Do While rs.EOF = False
    rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing
    End If
    conn.Close
    Set conn = Nothing

    Ciao, Craig


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center