M
mcgavock
Ok here is a simple page i put together to add entries into a
database....yet its not adding anythign to the database....i cannot see
why not....ideas????
I know i'm a n00b at asp and what i got i kinda pieced together from
another site....but i dont see why this isnt working.
<html>
<Head><Title>Purchasing and Inverntory System</title></head>
<Meta http-equiv="pragma" content="no-cache">
<%
function add1()
dim rsInventory
dim rsSites
dim cmdInventory
dim cmdSites
dim ServerGetDB
dim curItem
Set ServerGetDB = Server.CreateObject("ADODB.Connection")
ServerGetDB.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"&"Data
Source=c:\db\purchasing.mdb"
ServerGetDB.open
Set cmdInventory = Server.CreateObject("ADODB.Command")
cmdInventory.CommandText="SELECT * from equip"
Set cmdInventory.ActiveConnection = ServerGetDB
Set rsInventory = cmdInventory.Execute
Set cmdSites = Server.CreateObject("ADODB.Command")
cmdSites.CommandText="SELECT siteName from sites"
Set cmdSites.ActiveConnection = ServerGetDB
Set rsSites = cmdSites.Execute
Response.Write "<form action='add.asp' method='GET' id=formAdd
name=formAdd>"
Response.Write "<table border=1><tr>"
Response.Write "<td>Tag Number:</td><td><input type='text'
name='inv_tag' size='5'></td></tr>"
Response.Write "<tr><td>Equipment Name:</td><td><input type='text'
name='eq_name' size='30'</td></tr>"
Response.Write "<tr><td>Serial Number:</td><td><input type='text'
name='eq_serial_numb' size='30'</td></tr>"
Response.Write "<tr><td>Site:</td><td><select name='site'>"
count=1
do while not rsSites.EOF
Response.Write "<option value='" & trim(rsSites("siteName")) & "'>" &
trim(rsSites("siteName")) & "</option>"
rsSites.movenext
count=count+1
loop
Response.Write "</td></tr>"
Response.Write "<tr><td>Room:</td><td><input type='text' name='eq_room'
size='30'</td></tr>"
Response.Write "<tr><td>Inspection Date:</td><td><input type='text'
name='insp_date' size='10'</td></tr>"
Response.Write "<tr><td>Cetrification Date:</td><td><input type='text'
name='eq_cert_date' size='10'</td></tr>"
Response.Write "<tr><td>Purchase Date:</td><td><input type='text'
name='pur_date' size='10'</td></tr>"
Response.Write "<tr><td>Purchase Price:</td><td><input type='text'
name='pur_price' size='30'</td></tr></table><br><br>"
Response.Write "<input type='submit' name='action' value='Add'>"
Response.write "</form>"
rsSites.close
rsInventory.close
ServerGetDB.close
end function
call main
function AddItem()
dim rsInventory
dim cmdInventory
dim ServerGetDB
dim curItem
Set ServerGetDB = Server.CreateObject("ADODB.Connection")
ServerGetDB.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"&"DataSource
= c:\db\purchasing.mdb"
ServerGetDB.open
Set cmdInventory = Server.CreateObject("ADODB.Command")
cmdInventory.CommandText= "SELECT * from equip"
Set cmdInventory.ActiveConnection = ServerGetDB
Set rsInventory = cmdInventory.Execute
Set rsInventory = Server.CreateObject("ADODB.Recordset")
rsInventory.ActiveConnection=ServerGetDB
rsInventory.CursorType=adOpenKeyset
rsInventory.LockType=adLockOptimistic
rsInventory.Source="Select * from equip"
rsInventory.Open
rsInventory.AddNew
rsInventory("insp_date")=request("insp_date")
rsInventory("sites")=request("siteName")
rsInventory("inv_tag")=request("inv_tag")
rsInventory("pur_date")=request("pur_date")
rsInventory("eq_name")=request("eq_name")
rsInventory("eq_serial_numb")=request("eq_serial_numb")
rsInventory("eq_cert_date")=request("eq_cert_date")
rsInventory("eq_room")=request("eq_room")
rsInventory("pur_price")=request("pur_price")
Response.Write "Tag # " & Ucase (request("inv_tag")) & " was added."
rsInventory.update
rsInventory.close
ServerGetDB.close
set rsInventory=nothing
set cmdInventory=nothing
setServerGetDB=nothing
end function
sub main()
select case action
case "Add" AddItem()
case "add1" add1()
end select
add1
end sub
%>
</html>
database....yet its not adding anythign to the database....i cannot see
why not....ideas????
I know i'm a n00b at asp and what i got i kinda pieced together from
another site....but i dont see why this isnt working.
<html>
<Head><Title>Purchasing and Inverntory System</title></head>
<Meta http-equiv="pragma" content="no-cache">
<%
function add1()
dim rsInventory
dim rsSites
dim cmdInventory
dim cmdSites
dim ServerGetDB
dim curItem
Set ServerGetDB = Server.CreateObject("ADODB.Connection")
ServerGetDB.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"&"Data
Source=c:\db\purchasing.mdb"
ServerGetDB.open
Set cmdInventory = Server.CreateObject("ADODB.Command")
cmdInventory.CommandText="SELECT * from equip"
Set cmdInventory.ActiveConnection = ServerGetDB
Set rsInventory = cmdInventory.Execute
Set cmdSites = Server.CreateObject("ADODB.Command")
cmdSites.CommandText="SELECT siteName from sites"
Set cmdSites.ActiveConnection = ServerGetDB
Set rsSites = cmdSites.Execute
Response.Write "<form action='add.asp' method='GET' id=formAdd
name=formAdd>"
Response.Write "<table border=1><tr>"
Response.Write "<td>Tag Number:</td><td><input type='text'
name='inv_tag' size='5'></td></tr>"
Response.Write "<tr><td>Equipment Name:</td><td><input type='text'
name='eq_name' size='30'</td></tr>"
Response.Write "<tr><td>Serial Number:</td><td><input type='text'
name='eq_serial_numb' size='30'</td></tr>"
Response.Write "<tr><td>Site:</td><td><select name='site'>"
count=1
do while not rsSites.EOF
Response.Write "<option value='" & trim(rsSites("siteName")) & "'>" &
trim(rsSites("siteName")) & "</option>"
rsSites.movenext
count=count+1
loop
Response.Write "</td></tr>"
Response.Write "<tr><td>Room:</td><td><input type='text' name='eq_room'
size='30'</td></tr>"
Response.Write "<tr><td>Inspection Date:</td><td><input type='text'
name='insp_date' size='10'</td></tr>"
Response.Write "<tr><td>Cetrification Date:</td><td><input type='text'
name='eq_cert_date' size='10'</td></tr>"
Response.Write "<tr><td>Purchase Date:</td><td><input type='text'
name='pur_date' size='10'</td></tr>"
Response.Write "<tr><td>Purchase Price:</td><td><input type='text'
name='pur_price' size='30'</td></tr></table><br><br>"
Response.Write "<input type='submit' name='action' value='Add'>"
Response.write "</form>"
rsSites.close
rsInventory.close
ServerGetDB.close
end function
call main
function AddItem()
dim rsInventory
dim cmdInventory
dim ServerGetDB
dim curItem
Set ServerGetDB = Server.CreateObject("ADODB.Connection")
ServerGetDB.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"&"DataSource
= c:\db\purchasing.mdb"
ServerGetDB.open
Set cmdInventory = Server.CreateObject("ADODB.Command")
cmdInventory.CommandText= "SELECT * from equip"
Set cmdInventory.ActiveConnection = ServerGetDB
Set rsInventory = cmdInventory.Execute
Set rsInventory = Server.CreateObject("ADODB.Recordset")
rsInventory.ActiveConnection=ServerGetDB
rsInventory.CursorType=adOpenKeyset
rsInventory.LockType=adLockOptimistic
rsInventory.Source="Select * from equip"
rsInventory.Open
rsInventory.AddNew
rsInventory("insp_date")=request("insp_date")
rsInventory("sites")=request("siteName")
rsInventory("inv_tag")=request("inv_tag")
rsInventory("pur_date")=request("pur_date")
rsInventory("eq_name")=request("eq_name")
rsInventory("eq_serial_numb")=request("eq_serial_numb")
rsInventory("eq_cert_date")=request("eq_cert_date")
rsInventory("eq_room")=request("eq_room")
rsInventory("pur_price")=request("pur_price")
Response.Write "Tag # " & Ucase (request("inv_tag")) & " was added."
rsInventory.update
rsInventory.close
ServerGetDB.close
set rsInventory=nothing
set cmdInventory=nothing
setServerGetDB=nothing
end function
sub main()
select case action
case "Add" AddItem()
case "add1" add1()
end select
add1
end sub
%>
</html>