-
Feb 22nd, 2012, 01:29 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] ASP Counter
I've got the following code that pulls data from my Access Database.
Right now, it loads all of today's data into one table, which is sorted Ascending by MedicationGiven, then DESCENDING by ID.
Ideally, I'd like to show separate tables for each possible type of MedicationGiven (which I don't want to set statically, in case they add more later) with a summary of the total dosage given on the bottom of each table.
Currently, this code works but just shows all medications given in one table, and with no summarization.
I'm very new to ASP.net and to coding in general, so please be gentle.
Thanks kindly.
Code:
<html>
<head></head>
<body>
<%
Dim medtotal
medtotal = "0"
Dim rowcount
rowcount = "0"
Dim strToday
strToday = Date()
strUN = Request.QueryString("un")
If strUN = "" Then
Response.Redirect "index.asp"
Else
End If
Response.Write strToday
'Open the recordset with the SQL query
rsMain.Open strSQLMain, adoCon
Response.Write ("<center>")
Response.Write ("<table border=""2"" cellspacing=""0"" cellpadding=""0"" width=""100%"" id=""table1"">")
Response.Write ("<tr>")
'Response.Write ("<tr background=""images/rtcolumn2.jpg"">")
Response.Write ("<td bgcolor=""e5ded2"" width=""200""><u><center>Entered Date & Time</u>:</center></td>")
Response.Write ("<td bgcolor=""e5ded2"" width=""300""><u><center>Medication Given</u>:</center></td>")
Response.Write ("<td bgcolor=""e5ded2"" width=""200""><u><center>Dosage Given</u>:</center></td>")
Response.Write ("<td bgcolor=""e5ded2"" width = ""150""><u><center>Patient ID</u>:</center></td>")
'Response.Write ("<td background=""images/grayback.png""><b><center>By:</center></td>")
'Response.Write ("<td><b>DateDiff:</td>")
Response.Write ("</tr>")
'Response.Write strToday
'Loop through the recordset
Do While Not rsMain.EOF
If rsMain("EnteredBy") = strUN Then
'If we're dealing with YOUR records - display them.
'Check to see if they're from today.
If CDate(rsMain("EnteredDate")) = CDate(strToday) Then
'They're today's active records - put them into the table
Response.Write ("<tr>")
Response.Write ("<td>")
Response.Write (rsMain("EnteredDate")& " " & rsMain("EnteredTime") & " " & rsMain("EnteredAMPM"))
Response.Write ("</td>")
Response.Write ("<td>")
Response.Write (rsMain("MedicationGiven"))
Response.Write ("</td>")
Response.Write ("<td>")
Response.Write (rsMain("DosageGiven"))
Response.Write ("</td>")
Response.Write ("<td>")
Response.Write (rsMain("PatientID"))
Response.Write ("</td>")
Else
'They're from another day - we'll use the previous days viewer later to display them.
End If
'Response.Write("Item Found with un: " & strUN & "<br>")
Else
'These aren't your records - skip to the next item and do nothing
'Response.Write("Item Found without un: " & strUN & "<br>")
End If
'END TABLE
Response.Write ("</tr>")
Response.Write ("</font>")
'END OF RECORD - MOVE TO NEXT
rsMain.MoveNext
Loop
Response.Write ("</table>")
Response.Write ("<br>")
'Reset server objects
rsMain.Close
Set rsMain = Nothing
Set adoCon = Nothing
%>
</body>
</html>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|