Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 1st, 2004, 11:21 PM
MalwinderGill MalwinderGill is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 2 MalwinderGill User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
please help me to get the data from the database

hi
i am trying to get the data from the access database in the web page. i got success to get the record for the for the first page now i am trying to link that records with another table to get the relevant record.

i have two different tables in my database, one is manufacturer which has two datafields one is manufacturer_id and manufacturer_name and the second is models which has near about 10 fields. but both tables has same data in manufacuture_id and maker_id fields i want to relate these two fields to get result on second page. i am sending the code for both pages please help me to fix the problem.

my first files code is
<html>
<head>
<tittle><center>
<body topmargin="0" >
<table >
<tr>
<td width="740" align="left" valign="top" height="158">
<img border="0" src="images/banner.gif"></td>
</tr>
</table>
<table>
<tr>
<td width="235" height="94">
<img border="0" src="images/images/contact_01.gif" width="235" height="94"></td>
<td width="505" height="94">
<img border="0" src="images/images/contact_02.gif" width="505" height="94"></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="740" id="AutoNumber3">
<tr>
<td width="254" background="images/4.gif" align="left" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="200" id="AutoNumber4">
<tr>
<td width="25">&nbsp;</td>
<td width="175">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber5">
<tr>
<td width="100%" bgColor="#777777"><span class="white">&nbsp;</span></td>
</tr>
<tr>
<td bgColor="#a7a7a7">
<table cellSpacing="0" cellPadding="10" border="0">
<tr>
<td width="165" bgColor="#ffffff"><center><b>Telephone</b><br>
<font color="#727272" size="4"><b>519 739 0037</b></font><br>
<b>Email.</b>
</center></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="486" background="images/5.gif" align="center">
<%@ LANGUAGE="VBScript" %>
<%
Dim cnnSimple
Dim rstSimple
Dim strDBPath
Dim iCounter
Dim sRowColor

strDBPath = Server.MapPath("fpdb/truck.mdb")
Set cnnSimple = Server.CreateObject("ADODB.Connection")
Set cnnSimple = Server.CreateObject("ADODB.Connection")
cnnSimple.Open("DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & Server.MapPath("fpdb/truck.mdb"))
Set rstSimple = cnnSimple.Execute("SELECT * FROM manufacturer")
%>
<table width="400" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td height="30">&nbsp;</td>
<td height="30">&nbsp;</td>
</tr>
<%
iCounter = 0
Do While Not rstSimple.EOF
iCounter = iCounter + 1
If iCounter > 500 Then
Response.Write "Too Many Records to display. Greater Than 500 Records in Table."
Exit Do
End If
If sRowColor = " class=DB2ASPlight" Then
sRowColor = " class=DB2ASPdark"

Else
sRowColor = " class=DB2ASPlight"
End If
%>
<tr>
<td <%=sRowColor%> height="20">
<a href="truckinfo.asp?manufacturer_id=<%= rstSimple.Fields("manufacturer_id").Value%>">
<%= rstSimple.Fields("manufacturer_id").Value %></a></td>
<td <%=sRowColor%> height="20"><%= rstSimple.Fields("manufacturer_name").Value %></td>
</tr>
<%
rstSimple.MoveNext
Loop
%>
</table>
<%
cnnSimple.Close

%> </td>
</tr>
</table>
<img border="0" src="images/footer.gif">
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</center>
</body>
</center>
</html>


-----------------------------------------------------------------------------------------------------------------------------------------
and my second file is




<html>
<head>
<tittle><center>
<body topmargin="0" >
<table >
<tr>
<td width="740" align="left" valign="top" height="158">
<img border="0" src="images/banner.gif"></td>
</tr>
</table>
<table>
<tr>
<td width="235" height="94">
<img border="0" src="images/images/contact_01.gif" width="235" height="94"></td>
<td width="505" height="94">
<img border="0" src="images/images/contact_02.gif" width="505" height="94"></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="740" id="AutoNumber3">
<tr>
<td width="254" background="images/4.gif" align="left" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="200" id="AutoNumber4">
<tr>
<td width="25">&nbsp;</td>
<td width="175">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber5">
<tr>
<td width="100%" bgColor="#777777"><span class="white">&nbsp;</span></td>
</tr>
<tr>
<td bgColor="#a7a7a7">
<table cellSpacing="0" cellPadding="10" border="0">
<tr>
<td width="165" bgColor="#ffffff"><center><b>Telephone</b><br>
<font color="#727272" size="4"><b>519 739 0037</b></font><br>
<b>Email.</b> </center></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="486" background="images/5.gif" align="center">
<%@ LANGUAGE="VBScript" %>
<%
Dim cnnSimple
Dim rstSimple
Dim strDBPath
Dim iCounter
Dim sRowColor
Dim SQLStmt
strDBPath = Server.MapPath("fpdb/truck.mdb")
manufacturer_id=Request.QueryString("manufacturer_id")
Set cnnSimple = Server.CreateObject("ADODB.Connection")
Set cnnSimple = Server.CreateObject("ADODB.Connection")
cnnSimple.Open("DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & Server.MapPath("fpdb/truck.mdb"))
Set rstSimple = cnnSimple.Execute("select * from models where maker_id=manufacturer_id")
%>
<table width="400" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse" bordercolor="#111111" >

<tr> <td height="30">&nbsp;</td>
<td height="30">&nbsp;</td>
</tr>
<%
iCounter = 0
Do While Not rstSimple.EOF
iCounter = iCounter + 1
If iCounter > 500 Then
Response.Write "Too Many Records to display. Greater Than 500 Records in Table."
Exit Do
End If
If sRowColor = " class=DB2ASPlight" Then
sRowColor = " class=DB2ASPdark"

Else
sRowColor = " class=DB2ASPlight"
End If
%>
<tr>
<td <%=sRowColor%> height="20"><%= rstSimple.Fields("model_id").Value %></td>
<td <%=sRowColor%> height="20"><%= rstSimple.Fields("maker_id").Value %></td>
<td <%=sRowColor%> height="20"><%= rstSimple.Fields("model").Value %></td>
</tr>
<%
rstSimple.MoveNext
Loop
%>
</table>
<%
rstSimple.Close
Set rstSimple = Nothing
cnnSimple.Close
Set cnnSimple = Nothing

%>

</td>
</tr>
</table>
<img border="0" src="images/footer.gif"> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</center>
</body>
</center>
</html>

Reply With Quote
  #2  
Old April 5th, 2004, 12:12 PM
spungebob spungebob is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Dover
Posts: 128 spungebob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 39 sec
Reputation Power: 5
Answer

Set rstSimple = cnnSimple.Execute("select * from models where maker_id=" & Request.querystring("manufacturer_id") & """)"

maker_id is short for manufacturer id correct!


Bob@lyrex.com

Last edited by spungebob : April 5th, 2004 at 12:14 PM. Reason: mistake made

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > please help me to get the data from the database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT