Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this same as Visual Basic? If so, Database connection question...

Status
Not open for further replies.

Ovatvvon

Programmer
Feb 1, 2001
1,514
US
Hello,
Not sure if this is the right place or not...just says Basic, but also says Microsoft.

I'll take a go at it though:

Question:
I'm wondering how to connect to a Micrsoft Access Database and interact with the fields.

Trying to do:
I have a form that I want to add information to the database based on who is attending musical concerts in a local area. Simple, yet effective for my needs.

Knowledge:
I currently program .asp pages, but have started learning VB 6.0 pro. I know that with .asp, I can create a DSN database ADO connection through code similar to this:

Set conn = Server.CreateObject("ADODB.Connection")
DSNtemp = "DRIVER={Microsoft Access Driver(*.mdb)};
DSNtemp = DSNtemp & "DBQ=C:\MyFolder\MyDatabase.mdb;"
conn.Open DSNtemp
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 3, 3

I'm wondering what the equivelant would be in VB, and, I'm sure it does, but just to make sure, does it still use sql statement format for interaction?

sql = "SELECT * FROM myTable WHERE ((myTable.firstName)='theirFirstName');"

response.write rs("firstName") & " " & rs("lastName")


Any help would be greatly appreciated!!! Thank you!

-Ovatvvon
 
i might be way off, but i've connected to db by making a reference to msado25.dll. this example uses a dsn, but could quickly be change.

dim c as new adodb.connection
dim r as new adodb.recordset

on error goto somewhere

c.open sDSN
c.execute ("select * from table")

let me know if this helps :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top