Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Attach db and connect with taht (6.0)

    I want to attach the db (present into dir of my project) and after connect it...
    Have variuos error.
    note:
    myserver name "cl259f4500"
    no password no user (use sqlexpress free)

    Private Sub Command1_Click()
    Dim cn As ADODB.Connection
    Set cn = New Connection

    Dim cOn As ADODB.Connection
    Set cOn = New Connection
    cn.ConnectionString = "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
    "Persist Security Info=False;" & _
    "AttachDBFileName=" & App.Path & "northwnd.mdf;Data Source=CL259F4500"
    'cn.Close
    'cOn = Nothing
    cOn.ConnectionString = "Data Source=CL259F4500;Initial Catalog=northwnd;Integrated Security=SSPI;Persist Security Info=False"

    cOn.Open

    Dim rs As Recordset
    Set rs = New Recordset
    rs.Open "Select * from orders", cn
    Set MSHFlexGrid1.DataSource = rs

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Attach db and connect with taht (6.0)

    Sal, I have moved many of your questions about Access/SQL to the Access forum, and now you post another one in the wrong forum. I'm not going to move this one, I'm locking it instead.

Posting Permissions

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