chrscote
01-26-2009, 10:40 AM
First off, it has been a while since I've coded any ASP, so the question I have may seem pretty basic. I have a form in which I am displaying the current values in a database. When the user edits one of the fields and clicks the Update button, I have an ASP page that takes in all of the pertinent data and is supposed to use and Update statement to update the database. However, I think I may be using the Update statement wrong. Here is my code:
set rsShips=Server.CreateObject("ADODB.Recordset")
if Request.Form("update")<>"" then
id = Request.Form("id")
hullNum = Request.Form("hullNum")
hullName = Request.Form("hullName")
shipClass = Request.Form("shipClass")
dim updateSql
updateSql = "Update dbo_tblHull SET Hull_Number="&hullNum&", hullName='"&hullName&"', classId="&shipClass&" WHERE HullID="&id
rsShips.Open updateSql
end if
'More code to get the latest values of all the fields
However, when I change the values in the form and hit Update, I get the original values displayed back in the form.
I have a feeling that it has to do with the last statement in the code since I have run the updateSql query in Access and it works fine.
Chris
set rsShips=Server.CreateObject("ADODB.Recordset")
if Request.Form("update")<>"" then
id = Request.Form("id")
hullNum = Request.Form("hullNum")
hullName = Request.Form("hullName")
shipClass = Request.Form("shipClass")
dim updateSql
updateSql = "Update dbo_tblHull SET Hull_Number="&hullNum&", hullName='"&hullName&"', classId="&shipClass&" WHERE HullID="&id
rsShips.Open updateSql
end if
'More code to get the latest values of all the fields
However, when I change the values in the form and hit Update, I get the original values displayed back in the form.
I have a feeling that it has to do with the last statement in the code since I have run the updateSql query in Access and it works fine.
Chris