Active Server Pages Programming (ASP)/asp update

Advertisement


Question
QUESTION: 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.

Answer
if 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")  

Active Server Pages Programming (ASP)

All Answers


Answers by Expert:


Ask Experts

Volunteer


Ashley Brazier

Expertise

Main focus is ASP, SQL Server 2000 & 2005

Experience

Over 6 years experience.

Education/Credentials
BCs Honours Software Design and Networks

©2012 About.com, a part of The New York Times Company. All rights reserved.