| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
when i click on my update button and try to update a record whith a duplicate user name
i should get a message at the top of the form that reads " this is a duplicate name please select a new name" but what i get is the following error: Error Type: Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression 'UserName='lemonjello'23'. /suredatainc/Admin/EditUser.asp, line 87 here is the code: <% // *** Redirect if username exists var MM_flag="MM_update"; if (String(Request(MM_flag)) != "undefined") { var MM_dupKeyRedirect="EditUser.asp?repeat=true"; var MM_rsKeyConnection=MM_conSureData_STRING; var MM_dupKeyUsernameValue = String(Request.Form("UserName")); var MM_dupKeySQL = "SELECT UserName FROM Users WHERE UserName='" + MM_dupKeyUsernameValue + "'" + Request("MM_recordId") var MM_adodbRecordset = "ADODB.Recordset"; var MM_rsKey = Server.CreateObject(MM_adodbRecordset); MM_rsKey.ActiveConnection = MM_rsKeyConnection; MM_rsKey.Source = MM_dupKeySQL; MM_rsKey.CursorType=0; MM_rsKey.CursorLocation=2; MM_rsKey.LockType=3; MM_rsKey.Open(); <------------------------------this is the line it errors on. if (!MM_rsKey.EOF || !MM_rsKey.BOF) { // the username was found - can not add the requested username var MM_qsChar = "?"; if (MM_dupKeyRedirect.indexOf("?") >= 0) MM_qsChar = "&"; MM_dupKeyRedirect = MM_dupKeyRedirect + MM_qsChar + "requsername=" + MM_dupKeyUsernameValue; Response.Redirect(MM_dupKeyRedirect); } MM_rsKey.Close(); } %> send help quick, lemonjello |
|
#2
|
||||
|
||||
|
try this line instead
Code:
var MM_dupKeySQL = "SELECT UserName FROM Users WHERE UserName = '" & Request.Form("Username") & "'"
|
|
#3
|
|||
|
|||
|
i tried it and this is the error i get now. not sure why tho.
Error Type: Microsoft JET Database Engine (0x80040E14) Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. /suredatainc/Admin/EditUser.asp, line 87 p.s. thanks for the help it is greatly appreciated. Last edited by lemonjello : June 5th, 2004 at 02:21 PM. Reason: different text |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > syntax error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|