Results 1 to 4 of 4

Thread: Connection Problem

  1. #1

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Connection Problem

    hello i have a database n i want to connect to it using ADODB.connection, this is the code i use

    Dim con As New ADODB.Connection
    Dim data As New ADODB.Record

    data.Open "select * from table1", con
    MsgBox data.fields(0)

    but it says "The connetion can't be used to perform this operation, it is either closed or invalid in this context"

  2. #2

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Re: Connection Problem

    sorry this is the actual code i use

    Dim con As New ADODB.Connection
    Dim data As New ADODB.Record

    con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\My Documents\db1.mdb;Persist Security Info=False"

    data.Open "select * from table1", con
    MsgBox data.fields(0)

  3. #3
    Addicted Member nickname's Avatar
    Join Date
    Sep 2004
    Location
    Europe - Belgium
    Posts
    170

    Re: Connection Problem

    try

    VB Code:
    1. Dim data As New ADODB.RecordSet

    nickname
    Software Engineer
    DBA
    Webdesigner
    --
    to code or to be coded, that's the question

  4. #4

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Resolved Re: Connection Problem

    thnkx ... actually i figured it out maself that i shud have used Recordset instead of Record

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