PDA

Click to See Complete Forum and Search --> : How can I access a database without using controls?


Carlos
Oct 26th, 1999, 08:45 PM
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

Clunietp
Oct 26th, 1999, 10:36 PM
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