SQL Error page cannot display

R

robert

Whats wrong w/ my code, the Cust_ID cannot change (it's autonumber
from access 2000), i'm getting a page cannot display error:


<%Dim ChangePass
Set ChangePass = Server.CreateObject("ADODB.Connection")

ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; "
ConnStr = ConnStr & "DBQ=" & Server.MapPath("..\fpdb\aaqa.mdb")
ChangePass.Open(ConnStr)

SQLtemp = "SELECT * FROM contact_TBL WHERE Cust_ID = '" &
request.form("Cust_ID") & "' "
Set rs = ChangePass.Execute(SQLtemp)

while not rs.eof

If Request.Form("Cust_ID") = rs("Cust_ID") then
SQL = "UPDATE contact_TBL SET Cust_Name = '" &
Request.Form("Cust_Name") & "' " WHERE Cust_ID = '" &
Request.Form("Cust_ID") & "'
ChangePass.Execute(sql)

Response.redirect ("updated2.asp")
Else
Response.redirect ("changerror.asp")

End If
rs.MoveNext
Wend

OnError response.Redirect ("changerror.asp")
rs.Close
ChangePass.Close
set ConnStr = Nothing

%>
 
T

Thomas A. Rowe

Try:

<%
Dim ChangePass
Set ChangePass = Server.CreateObject("ADODB.Connection")

ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; "
ConnStr = ConnStr & "DBQ=" & Server.MapPath("..\fpdb\aaqa.mdb")
ChangePass.Open(ConnStr)

' the following all on 1 line
SQLtemp = "SELECT * FROM contact_TBL WHERE Cust_ID = " & request.form("Cust_ID")
' end of my change

Set rs = ChangePass.Execute(SQLtemp)

while not rs.eof

If Request.Form("Cust_ID") = rs("Cust_ID") then

' the following all on 1 line
SQL = "UPDATE contact_TBL SET Cust_Name = '" & Request.Form("Cust_Name") & "' WHERE Cust_ID = " &
Request.Form("Cust_ID")
' end of my change

ChangePass.Execute(sql)
Response.redirect ("updated2.asp")
Else
Response.redirect ("changerror.asp")

End If
rs.MoveNext
Wend

OnError response.Redirect ("changerror.asp")
rs.Close
ChangePass.Close
set ConnStr = Nothing

%>

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top