Results 1 to 2 of 2

Thread: How can I access a database without using controls?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Lexington, KY USA
    Posts
    2

    Post

    I am trying to access a database(mydatabase.mdb) using Visual Basic 5.0(6.0). How can I access the data WITHOUT using a data control?

    Thanks in advance

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    add a reference to ms active x data object objects 2.x

    dim rs as recordset
    dim cn as new connection

    cn.connectionstring = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=c:\my\path\to\database.mdb"

    cn.open

    set rs = cn.execute("select * from mytable")

    msgbox rs.fields("fieldname").value

    All done

    HTH

    Tom

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