Results 1 to 13 of 13

Thread: Connectting SQL 2005 with VB6

Hybrid View

  1. #1
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Connectting SQL 2005 with VB6


  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    110

    Re: Connectting SQL 2005 with VB6

    thanks

    i've tried this

    Code:
    Provider=SQLNCLI;Server=myServerName\theInstanceName;Database=myDataBase;Trusted_Connection=yes;
    but what should i put in the place of a provider..??

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    110

    Re: Connectting SQL 2005 with VB6

    Code:
    Set cn = New ADODB.Connection
        cn.ConnectionString = "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
            "Persist Security Info=False;" & _
            "AttachDBFileName= C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\bank.mdf;Data Source=KONG-DCCEC8B2B4\sql2005"
    
        cn.Open
            Set rs = New ADODB.Recordset
            rs.Open "Select * from orders", cn
        cn.Close
    i've used te above code but it keeps giving different errors. now its telling me that i've already got that databse existing and therefore i cannot use cn.open

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