SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

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 May 27th, 2002, 04:43 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Checking DB For Existing UserID

<i><b>Originally posted by : Hugh (beginner) (webmaster@unclehughie.com)</b></i><br />I want to check a SQL database to see if a new UserID entered by a customer in a Web form textbox already exists and, if so, inform the customer to try again. Do I really have to use a DataAdapter and a DataSet to do this. It seems a lot of work just to retrieve and check for the existence of one value. Can anyone show me a simpler way, please?<br />

Reply With Quote
  #2  
Old June 7th, 2002, 05:12 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Kylua (colin@kylua.com)</b></i><br /><br /><br /><br />------------<br />Hugh (beginner) at 5/27/2002 2:43:22 PM<br /><br />I want to check a SQL database to see if a new UserID entered by a customer in a Web form textbox already exists and, if so, inform the customer to try again. Do I really have to use a DataAdapter and a DataSet to do this. It seems a lot of work just to retrieve and check for the existence of one value. Can anyone show me a simpler way, please?<br /><br />The following code is what I've used to check if a user is there when logging in. I've set up the connection, queried with a where username = clause and then if there are no records, the username aint there. The relevant check is starred:<br /><br />dbfile=Server.MapPath("da_data.mdb") <br /> Set OBJdbConnection=Server.CreateObject("ADODB.Connection")<br /> OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& dbfile & ";"<br />'OBJdbConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbfile & ";" <br /><br /><br /> 'Set rs = Server.CreateObject("ADODB.Recordset")<br /> sql= "SELECT * FROM user Where Username = '" & Request.querystring("Username") & "'"<br /> response.write sql<br /> 'rs.Open sql, OBJdbConnection,3<br />Set rs = OBJdbConnection.Execute(SQL) <br /><br />'now we have the relevant data, let's check for a valid user/password<br /> *****if rs.eof then ***** response.redirect "No_user.asp"<br /> 'response.write rs.fields("password") & Request.querystring("Password")<br /> if rs.fields("password") <> Request.querystring("Password") then response.redirect "Wrong_Pass.asp"<br /><br />Not dead easy, but as easy as you're going to get.<br />(I think)<br /> <br /><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Checking DB For Existing UserID


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 5 hosted by Hostway