' Using VBScript/ASP to connect to an Access database
<%
Dim conn
Dim vcs
Set conn = Server.CreateObject("ADODB.Connection")
vcs= "Provider=Microsoft.Jet.OLEDB.4.0"
vcs= vcs & "; Data Source=" & Server.MapPath
("\Database\ExpressDataWeb.mdb")
conn.connectionstring = vcs
conn.open
%>
' to open the recordset and the data out
<%
Dim objrs1
Dim strSQL
Dim DateToday
DateToday=formatdatetime(DateAdd("d",-5,Date))
'Create the recordset object
Set objrs1 = Server.CreateObject("ADODB.Recordset")
'Set the SQL String
strSQL = "Select * from tblDispatch Where Account = '" & varAccount & "'"
strSQL = strSQL & " AND PickupDate >=" & "#" & DateToday & "#"
strSQL = strSQL & " AND TicketStatus <> '" & "Completed" & "'"
strSQL = strSQL & " AND TicketStatus <> '" & "Cancel" & "'"
strSQL = strSQL & " ORDER BY ControlNumber DESC"
'Response.Write strSQL
'Response.End
'Open the recordset getting all the data for this ticket
objrs1.Open strSQL, conn
%>
End of Recordset connection
Create HTML table to display data returned from recordset
<table border="0" align="center">
<tr>
<td class=tdtext><input type="button" name="Print" value="Print this Page"
onClick="print()" ;>
<input type=button value="Back" onClick="history.go(-1)";></td></tr>
<tr><td class=tdtext>Hint: Open Page Setup in browser and set to print
landscape or set in the printer popup dialog box</td></tr>
</table>
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.