| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I submit my form, and it goes to the response.redirect page. But it is not updating the DB... Can someone shine a light my way?
VERIFYING.ASP: (hidden page) <% dim upSQL,rs,objConn,connStr 'Server Side form validation to keep our database clean dim directorfname,directorlname,directoremail,address1 ,address2,city,state,zipcode,phone,directorpasswor d 'Save entered data from verify directorfname = Request.Form("directorfname") directorlname = Request.Form("directorlname") directoremail = Request.Form("directoremail") address1 = Request.Form("address1") address2 = Request.Form("address2") city = Request.Form("city") state = Request.Form("state") zipcode = Request.Form("zipcode") phone = Request.Form("phone") directorpassword = Request.Form("directorpassword") 'Check if Fields are empty if directorfname = "" then Response.write("Invalide Director First Name <A HREF=javascript:history.go(-1)>Go Back</A><br>") if directorlname = "" then Response.write("Invalide Director Last Name <A HREF=javascript:history.go(-1)>Go Back</A><br>") if directoremail = "" then Response.write("Invalide Director Email Address <A HREF=javascript:history.go(-1)>Go Back</A><br>") if address1 = "" then Response.write("Invalide Address <A HREF=javascript:history.go(-1)>Go Back</A><br>") if city = "" then Response.write("Invalide City <a HREF=javascript:history.go(-1)>Go Back</A><br>") if state = "" then Response.write("Invalide State <A HREF=javascript:history.go(-1)>Go Back</A><br>") if zipcode = "" then Response.write("Invalide Zip Code <A HREF=javascript:history.go(-1)>Go Back</A><br>") if phone = "" then Response.write("Invalide Phone Number <A HREF=javascript:history.go(-1)>Go Back</A><br>") if directorpassword = "" then Response.write("Invalide Director Password <A HREF=javascript:history.go(-1)>Go Back</A><br>") dim sname sname= "" & Session("name") & "" 'Build connection dbPath="users.mdb" on error resume next Set objConn = Server.CreateObject("ADODB.Connection") 'Set objConn as an Object connStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dbPath &";" objConn.Open(connStr) upSQL="UPDATE customers SET = customers.directorfname='" & rs("directorfname") & "', customers.directorlname='" & rs("directorlname") & "', customers.directoremail='" & rs("directoremail") & "', customers.address1='" & rs("address1") & "', customers.address2='" & rs("address2") & "', customers.city='" & rs("city") & "', customers.state='" & rs("state") & "', customers.zipcode='" & rs("zipcode") & "', customers.phone='" & rs("phone") & "', customers.directorpassword='" & rs("directorpassword") & "' WHERE customers.name= '"& (sname) &"'" objConn.Execute(upSQL) ' objConn.Close 'Set objConn = Nothing objConn.Close Set oRS = Nothing Set objConn = Nothing Response.Redirect("review.asp") %> Last edited by tbourworld : April 10th, 2004 at 09:11 PM. |
|
#2
|
|||
|
|||
|
Thank you in advance for your help
|
|
#3
|
||||
|
||||
|
1) Make sure you are connecting to the database
Code:
Conn.Open ConnStr Response.write(Conn.State) Response.end If Conn.State = 0, then you aren't connecting 2) Write your sql statement to the browser to make sure it is formatted properly and contains the correct values. Code:
upSql = "your update statement" Response.write(upSql) Response.end |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > <b>HELP</b> Updating DB and it does nothing |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|