Tracking System
Easy to know your packaging status.
Safety & Fast Dilivery Services.
<%
If strSearch <> "" Then
' MapPath of virtual database file path to a physical path.
' If you want you could hard code a physical path here.
strDBPath = Server.MapPath("straitsDB.mdb")
' Create an ADO Connection to connect to the sample database.
' We're using OLE DB but you could just as easily use ODBC or a DSN.
Set cnnSearch = Server.CreateObject("ADODB.Connection")
Set cnnSearcha = Server.CreateObject("ADODB.Connection")
' This line is for the Access sample database:
cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
cnnSearcha.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
' We're actually using SQL Server so we use this line instead:
'cnnSearch.Open "Provider=SQLOLEDB;Data Source=10.2.2.133;" _
'& "Initial Catalog=samples;User Id=samples;Password=password;" _
'& "Connect Timeout=15;Network Library=dbmssocn;"
' Build our query based on the input.
' strSQL = "SELECT last_name, first_name, sales " _
' & "FROM [sample] " _
' & "WHERE last_name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
' & "OR first_name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
' & "ORDER BY last_name;"
strSQL = "SELECT * from straitsDB where trackingID= "& strSearch &" "
strSQLa = "SELECT * from straitsDBdetails where trackingID= "& strSearch &" "
'strSQLa = "SELECT * " _
' & "FROM straitsDBdetails " _
' & "WHERE trackingID =" & strSearch & ""
' strSQLa = "SELECT staritsDB.trackingID, staritsDB.shipDate, staritsDB.deliveryDate, staritsDB.origin, staritsDB.destination, " _
'& " staritsDB.service,staritsDB.weightage, staritsDB.deliveredTo, straitsDBdetails.dateTime, straitsDBdetails.activity, " _
'& " straitsDBdetails.location, straitsDBdetails.details " _
' & "FROM staritsDB INNER JOIN straitsDBdetails ON staritsDB.[trackingID] = straitsDBdetails.[trackingID] " _
' & "WHERE staritsDB.[trackingID] =" & strSearch & ""
' Execute our query using the connection object. It automatically
' creates and returns a recordset which we store in our variable.
Set rstSearch = cnnSearch.Execute(strSQL)
Set rstSearcha = cnnSearcha.Execute(strSQLa)
' Display a table of the data in the recordset. We loop through the
' recordset displaying the fields from the table and using MoveNext
' to increment to the next record. We stop when we reach EOF.
' For fun I'm combining some fields and showwing you can do more then
' just spit out the data in the form it is in in the table.
%>
Your Tracking Result...
<% if rstSearcha.bof <> true or rstSearcha.EOF <> true then %>
TRACKING NO:<%= rstSearch.Fields("trackingID").Value %> |
STATUS:<%= rstSearch.Fields("status").Value %> |
SHIPMENT DATES
Ship date : <%= rstSearch.Fields("shipDate").Value %>
Delivery date : <%= rstSearch.Fields("deliveryDate").Value %> |
Shipment Location:<%= rstSearcha.Fields("location").Value %>
Shipment Destination:<%= rstSearch.Fields("destination").Value %> |
SHIPMENT FACTS
Service type:<%= rstSearch.Fields("service").Value %>
Weightage:<%= rstSearch.Fields("weightage").Value %> |
Delivered By:<%= rstSearch.Fields("deliveredBy").Value %>
Delivered To:<%= rstSearch.Fields("deliveredTo").Value %> |
<% end if %>
SHIPMENT TRAVEL HISTORY
|
Date/Time |
Activity |
Location |
Details |
<% if rstSearcha.bof <> true or rstSearcha.EOF <> true then %>
<%
Do While Not rstSearcha.EOF
%>
<%= rstSearcha.Fields("dateTime").Value %> |
<%= rstSearcha.Fields("activity").Value %> |
<%= rstSearcha.Fields("location").Value %> |
<%= rstSearcha.Fields("details").Value %> |
<%
rstSearcha.MoveNext
Loop
%><% else %>
No matching search results,Please enter a valid tracking number or contact us
|
<% end if %>
