Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 4th, 2004, 09:32 PM
lemonjello lemonjello is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 lemonjello User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy syntax error

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

Reply With Quote
  #2  
Old June 4th, 2004, 09:51 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
try this line instead
Code:
var MM_dupKeySQL = "SELECT UserName FROM Users WHERE UserName = '" & Request.Form("Username") & "'"

Reply With Quote
  #3  
Old June 5th, 2004, 02:20 PM
lemonjello lemonjello is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 lemonjello User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy i tried it and now i get a different error.

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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > syntax error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway