%
dim command
dim level
dim id
id = request("id")
if request("level") = 1 then
session("level") = 1
end if
if request("level") = 2 then
session("level") = 0
end if
level = session("level")
command = request("command")
if command = "logout" then
session("level") = 0
level = 0
command = ""
end if
if (level < 1) and (command = "edit" or command = "delete" or command="add" or command = "Save") then
command = ""
end if
if (command = "edit" or command = "delete" or command = "Save") and (id = 0) then
command = ""
end if
if command = "Cancel" then
command = ""
end if
dim dsn
dim objConn
dim jobObj
dsn="DBQ=" & Server.Mappath("md.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open dsn
Set jobObj = Server.CreateObject("ADODB.Recordset")
if command = "delete" then
jobObj.Open "select * from jobs where id = " & id, objConn, adOpenKeyset, adLockPessimistic
if not jobObj.EOF then
jobObj.Delete
end if
jobObj.Close
command = ""
end if
if command = "Save" then
jobObj.Open "select * from jobs where id = " & id, objConn, adOpenKeyset, adLockPessimistic
if not jobObj.EOF then
jobObj("title") = request("title")
jobObj("datecreated") = request("datecreated")
jobObj("desc") = request("desc")
jobObj.Update
end if
jobObj.Close
end if
if command = "add" then
jobObj.Open "select * from jobs", objConn, adOpenKeyset, adLockPessimistic
jobObj.AddNew
jobObj("title") = "Title Goes Here..."
jobObj("datecreated") = Now()
jobObj("desc") = "Desc goes here..."
jobObj.Update
command = ""
jobObj.Close
end if
jobObj.Open "select * from jobs order by datecreated desc", objConn
%>
Machine Device - Innovative solutions for all your equipment needs