Pulling data from Access by row

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We have a list of Projects on our website. And we have a database in Access
that contains data pertaining to each Project. We would like users of our
website to be able to double-click a Project name and retrieve the row of
data pertaining to that project. We will most likely be using .asp to manage
this. Can anyone help on how we can get .asp to pull this data in from the
Access table?
 
QAQueen said:
We have a list of Projects on our website. And we have a database in Access
that contains data pertaining to each Project. We would like users of our
website to be able to double-click a Project name and retrieve the row of
data pertaining to that project. We will most likely be using .asp to manage
this. Can anyone help on how we can get .asp to pull this data in from the
Access table?
Better asked in microsoft.public.inetserver.asp.db or
microsoft.public.access.internet
Generally tho, something like this (VBScript):

<%
OPtion explicit
dim DBPath, conntemp, SQL, MyRS

DBPath = Server.MapPath("../db/yourdb.mdb")
DBPath = Server.MapPath("/db/yourdb.mdb")
'One of the above depending on if ParentPath is true on your web server
set conntemp=server.createobject("adodb.connection")
cst = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & dbPath
set conntemp=server.createobject("adodb.connection")
conntemp.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & DBPath
SQL="select * from yourdbtable ORDER BY Last_Name"
set MyRS=conntemp.execute(SQL)
%>

Then in the body of your HTML, define a table to hold the lines to display.
Assume your table has columns named First_Name and Last_Name
<table>
<%Do while not MyRS.EOF%>
<tr>
<td><B><%=MyRS("First_Name") & " " & MyRS("Last_Name")%></td>
</tr>
<%MyRS.MoveNext
Loop
MyRs.close
Conntemp.close
set MyRS = nothing
set conntemp = nothing%>
</table>
Mike
 
Back
Top