%@ Language=JavaScript %>
<%
var pathToMDB = Server.MapPath("../../../../../kristiDB/kristi.mdb");
var kristiID = 147;
if(kristiID == "undefined")
{
Response.Write("Error: You must supply a kristiID for display.
\nExample: .../staff.asp?kristiID=12");
Response.End();
}
//Holds the Database Connection Object
var adoCon = new ActiveXObject("ADODB.Connection");
var resultSet = new ActiveXObject("ADODB.Recordset");
var query = "select * from tblKristiLogBook where internalKristiID=" + kristiID;
//Set an active connection to the Connection object using a DSN-less connection
try
{
adoCon.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" + pathToMDB);
}
catch(e)
{
Response.Write("Error: I could not open a connection to the Access Database.
\nReason:" + e.description);
Response.End();
}
try
{
// Make the call:
resultSet.open(query, adoCon);
var theKristi = new Object();
if(resultSet.EOF)
{
Response.Write("Sorry, you entered an invalid (out of range) kristiID Number (" + kristiID + "). Please check your typing, or the link that you clicked.");
resultSet.Close();
adoCon.Close();
Response.End();
}
else
{
//gather the information for display:
theKristi.serialnumber = new String( resultSet("strSerialNumber"));
theKristi.model = new String( resultSet("strModel"));
theKristi.builddate = new String( resultSet("strBuildDate"));
theKristi.engine = new String( resultSet("strEngine"));
theKristi.enginenumber = new String( resultSet("strEngineNumber"));
theKristi.buyer = new String( resultSet("strBuyer"));
theKristi.buyercity = new String( resultSet("strBuyerCity"));
theKristi.buyerstate = new String( resultSet("strBuyerState"));
theKristi.buyercountry = new String( resultSet("strCountry"));
theKristi.salesagent = new String( resultSet("strSalesAgent"));
theKristi.remarks = new String( resultSet("memRemarks"));
theKristi.currentowner = new String( resultSet("strCurrentOwner"));
theKristi.currentcondition = new String( resultSet("strCurrentCondition"));
theKristi.currentintendeduse = new String( resultSet("strCurrentIntendedUse"));
theKristi.currentcolor = new String( resultSet("strCurrentColor"));
theKristi.currentlocation = new String( resultSet("strCurrentLocation"));
theKristi.previousowners = new String( resultSet("strPreviousOwners"));
theKristi.othernotes = new String( resultSet("memOtherNotes"));
}
//clean up after ourselves:
resultSet.Close();
adoCon.Close();
//clean up our data a bit:
for(field in theKristi)
{
if(theKristi[field] == "null")
theKristi[field] = "unknown";
}
}
catch(e)
{
Response.Write("I could not query the database.
\nReason:" + e.description);
Response.End();
}
%>
|
|