Active Server Pages Programming (ASP)/asp update
Expert: Ashley Brazier - 7/16/2008
QuestionQUESTION: Hi! my update code runs and executes but does not update the database, can u please help.
<%
sSQL = "SELECT * FROM Detail where User='" & Request("User") &"'"
Set oRS = oConn.Execute(sSQL)
If Request("Submit") = "update" Then
sSQL = " update Detail SET"
sSQL = sSQL & "Equipment = '"& Request("Equipment") & "',"
sSQL = sSQL & "User = '"& Request("User") & "',"
sSQL = sSQL & "Manufacturer = '"& Request("Manufacturer") & "',"
sSQL = sSQL & "Model= '"& Request("Model") & "',"
sSQL = sSQL & "CPU = '"& Request("CPU") & "',"
sSQL = sSQL & "VGACard = '"& Request("VGACard") & "',"
sSQL = sSQL & "Office = '"& Request("Office") & "',"
sSQL = sSQL & "RAM = '"& Request("RAM") & "',"
sSQL = sSQL & "HardDisk = '"& Request("HardDisk") & "'"
sSQL = sSQL & "WHERE User = '"& Request("User") & "'"
oConn.Execute (sSQL)
Response.Write "Details of
" & Request("User") & " has been successfully updated<br>"
end if
oRS.Close
oConn.Close
Set oRS = Nothing
Set oConn = Nothing
%>
ANSWER: trying putting
response.write ssql
response.end()
before oConn.Execute (sSQL)
then send me what it prints out.
---------- FOLLOW-UP ----------
QUESTION: It does not print out anything, the code executes but the database is not updated.
Answerif that didn't print anything out then there is something wrong with
If Request("Submit") = "update" Then
Check what value Request("Submit") is print by doing this before the
If Request("Submit") = "update" Then
response.write Request("Submit")