|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
ASP Database table
I want to make an asp table for my database. I have two tables, one with peoples details and the other with their orders. I have done a one to many relationship between these.
What i would like to be able to do is a heading with the customer details, and under that all of what that person has ordered. Then another heading with a different customer and so on.. I'm really stuck, please help! Dave |
|
#2
|
|||
|
|||
|
Here is the code so far..
<html> <body bgcolor="#FFFFCC" text="#006600" style="text-align: left"> <% dim IP IP=Request.ServerVariables("REMOTE_ADDR") if IP <> "62.3.248.126" then Response.Redirect("access.htm") end if dim myConnection dim LoginInfoRst dim sqlString dim connectString set myConnection = Server.CreateObject("ADODB.Connection") set myConnection2 = Server.CreateObject("ADODB.Connection") set LoginInfoRst = Server.CreateObject("ADODB.Recordset") myConnection.Open "Data Source=" & Server.Mappath("npmc.mdb") & ";Provider=Microsoft.Jet.OLEDB.4.0;" sqlstring = "SELECT tblUsrDetails.*, tblPrescription.*" sqlstring = sqlstring & "FROM tblUsrDetails INNER JOIN tblPrescription ON tblUsrDetails.PatientID = tblPrescription.PatientID " sqlstring = sqlstring & "WHERE tblPrescription.PatientID = tblUsrDetails.PatientID " Set LoginInfoRst = myConnection.Execute(sqlString) if (LoginInfoRst.BOF) AND (LoginInfoRst.EOF) then %> <center> <p> </p> <p> </p> <font size="5" face="Arial, Helvetica, sans-serif" color="#006600"><b>No records found</b> </font> </center> <% else %> <form method="POST" action="aspdelete.asp"> <% do until LoginInfoRst.eof %> <table border="0" width="74%" cellspacing="0" cellpadding="0" id="table1"> <tr> <td> <table align=center COLSPAN=8 CELLPADDING=5 BORDER=0 WIDTH=457 height="57" id="table2"> <TR> <td valign=TOP bgcolor="#800000" width="85" align="center"> <div align="center"> <font face="Arial, Helvetica, sans-serif" color="#FFFFFF">Forename</font></div> </td> <TD VALIGN=TOP BGCOLOR="#800000" width="96" align="center"> <div align="center"> <font style="ARIAL NARROW" color="#ffffff" size="3" face="Arial, Helvetica, sans-serif"> Surname </font> </div> </td> <TD VALIGN=TOP BGCOLOR="#800000" width="100" align="center"> <div align="center"> <font face="Arial, Helvetica, sans-serif" color="#FFFFFF">Date of Birth</font></div> </td> <TD VALIGN=TOP BGCOLOR="#800000" width="126" align="center"> <div align="center"> <font face="Arial, Helvetica, sans-serif" color="#FFFFFF">Contact Number</font></div> </td> </tr> <tr> <td bgcolor="f7efde" align=center width="85" height="21"> <font style="arial narrow" size=2> <%=LoginInfoRst("Forname")%> </font> </td> <td bgcolor="f7efde" align=center width="96" height="21"> <font style="arial narrow" size=2> <%=LoginInfoRst("Surname")%> </font> </td> <td bgcolor="f7efde" align=center width="100" height="21"> <font style="arial narrow" size=2> <%=LoginInfoRst("DOB")%> </font> </td> <td bgcolor="f7efde" align=center width="126" height="21"> <font style="arial narrow" size=2> <%=LoginInfoRst("ContactNumber")%> </font> </td> <% session("ASD") = LoginInfoRst("tblUsrDetails.PatientID")%> </tr> </table> </td> </tr> </table> <table align=center COLSPAN=8 CELLPADDING=5 BORDER=0 WIDTH=606 height="64"> <TR> <td valign=TOP bgcolor="#800000" width="142"> <div align="center"> <font size="3" face="Arial, Helvetica, sans-serif" color="#FFFFFF"> Description </font></div> </td> <TD VALIGN=TOP BGCOLOR="#800000" width="58"> <div align="center"> <font style="ARIAL NARROW" color="#ffffff" size="3" face="Arial, Helvetica, sans-serif"> Strength </font> </div> </td> <TD VALIGN=TOP BGCOLOR="#800000" width="56"> <div align="center"> <font face="Arial, Helvetica, sans-serif" color="#FFFFFF">Quantity</font></div> </td> <TD VALIGN=TOP BGCOLOR="#800000" width="109"> <div align="center"> <font face="Arial, Helvetica, sans-serif" color="#FFFFFF">Other Items</font></div> </td> <td valign=TOP bgcolor="#800000" width="118"> <div align="center"> <font face="Arial, Helvetica, sans-serif" color="#FFFFFF">Chemist</font></div> </td> <td valign=TOP bgcolor="#800000" width="49"> <font face="Arial, Helvetica, sans-serif" color="#FFFFFF">Deliver</font></td> <td valign=TOP bgcolor="#800000" width="49"> <font face="Arial, Helvetica, sans-serif" color="#FFFFFF">Delete?</font></td> </tr> <% do until (LoginINfoRst("tblUsrDetails.PatientID") <> Session("ASD")) %> <tr> <td bgcolor="f7efde" align=center width="142" height="30"> <font style="arial narrow" size=2> <%=LoginInfoRst("Description")%> </font> </td> <td bgcolor="f7efde" align=center width="58" height="30"> <font style="arial narrow" size=2> <%=LoginInfoRst("Strength")%> </font> </td> <td bgcolor="f7efde" align=center width="56" height="30"> <font style="arial narrow" size=2> <%=LoginInfoRst("Quantity")%> </font> </td> <td bgcolor="f7efde" align=center width="109" height="30"> <font style="arial narrow" size=2> <%=LoginInfoRst("Other")%> </font> </td> <td bgcolor="f7efde" align=center width="118" height="30"> <font style="arial narrow" size=2><%=LoginInfoRst("Chemist")%> </font> </td> <td bgcolor="f7efde" align=center width="49" height="30"> <font style="arial narrow" size=2><%=LoginInfoRst("Deliver")%> </font> </td> <td bgcolor="f7efde" align=center width="49" height="30"> <font style="arial narrow" size=2><input type="checkbox" name="checkboxName"_ value='<%=LoginInfoRst("Prescription ID")%>'> </font> </td> </tr> <% LoginInfoRst.MoveNext %> <% loop %> </table> <% loop %> <p align="center"> </p> <p align="center"><input type="submit" value="Delete" name="B1"></p> </form> </body> <% end if %> |
|
#3
|
|||
|
|||
|
I get this error when running the code above, when there is only one order for a particualr customer.
error '80020009' Exception occurred. /database/respresc.asp, line 115 |
|
#4
|
|||
|
|||
|
How would you recommend fixing..?
Can i tell if there is only one record, and if there is it won't do a movenext? It needs to move next if there is more than one record. |
|
#5
|
|||
|
|||
|
Basically if you look at this site you will see what i'm trying to do.
http://www.npmc.nhs.uk/database/respresc.asp |
|
#6
|
|||
|
|||
|
Getting there, got rid of the error now trying to sort out the layout.
|
|
#7
|
|||
|
|||
|
Done it, yipee. Thanks echolalia
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > ASP Database table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|