Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    34

    Unanswered: From ACCESS to SQL Server

    Heya all.

    Currently I'm connecting to an ACCESS Database from VB with OLEDB.

    I want to make my database on a SQL Server and I heard it's not that complicated.

    Can someone show me at the right direction?

    Thanks
    Chen

  2. #2
    Join Date
    Jan 2004
    Posts
    184

    Re: From ACCESS to SQL Server

    Yes use ADO. Here is an example using ADO (Remember to add the Microsoft ActiveX Data Objects to your project)

    dim cn as ADODB.connection
    dim rs as ADODB.recordset

    set cn = new ADODB.connection

    cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DataBaseName;Data Source=ServerName"

    cn.open 'Now you have an open connection to Access

    set rs = new ADODB.recordset

    rs.actiiveconnection = cn

    rs.open "SELECT * FROM Table1"

    rs.close

    cn.close

    set rs=nothing
    set cn = nothing
    In abundance of water only the fool is thirsty. Bob Marley.

  3. #3
    Join Date
    Mar 2004
    Posts
    34
    Thanks a million!

    Out of curiosity,
    Is there no way to use OLEDB to connect to SQL servers?

  4. #4
    Join Date
    Jan 2004
    Posts
    184
    Yes you can, all the code would be the same except your connection string would change. However in the example I gave you it is OLEDB that is being used.

    Provider=SQLOLEDB.1
    In abundance of water only the fool is thirsty. Bob Marley.

  5. #5
    Join Date
    Mar 2004
    Posts
    34
    Thanks, you've been of great assitance.

Posting Permissions

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