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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a database via ASP and button 1

Status
Not open for further replies.

Portmoon

Programmer
Feb 24, 2003
11
0
0
MY
Hi I am trying open a database (MS Access) via an ASP.

It is a simple page with two options one link to enter the
site and the other that will allow the database administrator
access to the raw tables and records within. If possible I would like it to open the 'Main Menu' form in the database??
I have included the database connection script below but don't know how to incorporate a button around it, nor the SQL that is needed to open the database.
Security is not an issue regarding access to the database
this is only for personal use only.

<%

Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)Conn.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;myDatabase.mdb&quot;) & &quot;;pwd=myPassword&quot;

set rs = Server.CreateObject(&quot;adodb.RecordSet&quot;)
rs.open &quot;SELECT ???????

%>

Any guidance would be much appreciated!!

Thanks!!
 
Connection_STRING = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;myDatabase.mdb&quot;) & &quot;;pwd=myPassword&quot;

set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.ActiveConnection = Connection_STRING
rs.Source = &quot;SELECT * FROM AccessTable&quot;
rs.Open()

Your RS is now available to display - something like...

While (NOT rs.EOF)
response.write(rs(&quot;AccessField&quot;)&&quot;<BR>&quot;)
rs.MoveNext
Wend

Finally, close your connection before the page ends

rs.Close()

If you don't have too many fields, use a different RS for each table in your database.

Hope this makes sense.
BDC.
 
Thanks a lot BDC that did the trick once I figured it out!

Appreciate the helpful input,

Nice one!!

Portmoon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top