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

Pulling Info from an ACCESS database

Status
Not open for further replies.

DaveNamou

IS-IT--Management
Feb 7, 2002
175
US
I have a simple database with one table and 3 columns

Engineer.mdb
[EngineerName] [EngineerTitle] [EngineerNumber]

This database is changed quite often.

I would like to make a web page that builds a list from the items in the Database.

How do I pull information from a database to display it in an html page?

The database would be stored in the default directory of the website. C:\Inetpub\
Thank you Dave Namou, MCSE CCEA
 
Thanks, I'm new to all of the items you listed. But the website you gave me had a good basic sample using ASP. I just need to reverse engineer it to fit my needs.

Thanks again Dave Namou, MCSE CCEA
 
Here's how to do it using an Access database and ASP:

The data connection string ("objDC.Open") may not be appropriate for the database you are using. To determine the right data connection string, take a look at this site
Im pretty sure the SQL statement here will work on any SQL database, as well as Access.

<%@ Language=VBScript %>
<html><body>
<%
dim objdc, cmdTmp, objrs
set objdc = Server.CreateObject(&quot;ADODB.Connection&quot;)
set cmdTmp = Server.CreateObject(&quot;ADODB.Command&quot;)
set objrs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
objDC.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; & Server.Mappath(&quot;yourdatabasename.mdb&quot;) & &quot;;&quot;
dim strFacStaffName
strFacStaffName = Request.Form(&quot;FacStaffName&quot;)
cmdTmp.ActiveConnection = objdc
cmdtmp.CommandText = &quot;SELECT EngineerName, EngineerTitle, EngineerNumber FROM YourTableName Order By Engineername ;&quot;
objrs.Open cmdTmp,,1,3
%>
<table border=1 cellpadding=5 bgcolor=&quot;#ddd777&quot;><tr valign=&quot;middle&quot;><td>
<h2><font color=&quot;#000066&quot;>Engineer List</font></h2>
</td>
</tr>
</table>
<%
if objrs.EOF then
Response.Write&quot;<h1>There are no records</h1><br><br><br>&quot;
End If
%>
<p>
<table border=0 cellspacing=5 cellpadding=2>


<%
Do While Not objRS.EOF
Response.Write &quot;<tr><td><b><i><font color='#000066'>Engineer Name:</b></i></font></td><td>&quot; & objRS(&quot;EngineerName&quot;) & &quot;</td></tr>&quot;
Response.Write &quot;<tr><td><b><i><font color='#000066'>Engineer Title:</b></i></font></td><td>&quot; & objRS(&quot;EngineerTitle&quot;) & &quot;</td></tr>&quot;
Response.Write &quot;<tr><td><b><i><font color='#000066'>Engineer Number:</b></i></font></td><td>&quot; & objRS(&quot;EngineerNumber&quot;) & &quot;</td></tr>&quot;

objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
objdc.Close
Set objdc = Nothing
%>

</table>
</body></html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top