Results 1 to 8 of 8
Nov 7, 2011, 11:46 #1
- Join Date
- Nov 2011
- The Colony, TX
- 0 Post(s)
- 0 Thread(s)
Server.Transfer not working after clean SQL query
The short version: I've got a database where employees are required to enter a client's email address in order to get started.
I'm working on an asp script to check that email against the existing database to make sure it doesn't already exist.
Using either a Response.Redirect on error, or a Server.Transfer on success (IE: the email doesn't already exist)
I've set the column we're inserting to be unique in the SQL database, but every time I enter any email, I always get the error page, never the server.transfer. My code is below, I'm ommitting things like my server connection info (its stored in a separate asp page so I don't have to constantly call it. I'm using the server.transfer method because it retains the values in the earlier entered form, so I can autopopulate part of the form on the next page.
<!--#INCLUDE FILE="databaseconnectionSQL.asp" --> <% userid = session("userid") If Len(userid) = 0 Then response.redirect("login.asp?msg=Your Session is expired. Please Log-in again.") End If On Error Resume Next Dim strNewClientEmail, strEmpID, rs, strSQL strNewClientEmail = Request.Form("newclientemail") strEmpID = Session("empid") strSQL = "INSERT (rep_id, client_email) INTO client VALUES('" & strEmpID & "' , '" & strNewClientEmail & "')" set rs = RD.execute(strSQL) if err.number <> 0 then Response.Redirect("addclient.asp?error=This Email is already in our database") else Server.Transfer("addclient2.asp") end if %>
Thanks for any help or pointers you can give me!!