sql query question

Results 1 to 2 of 2

Thread: sql query question

  1. #1
    Join Date
    Dec 1969

    Default sql query question

    I have a page which allows users to edit their profile information. I use their email address as their username when they login. They have the option to change their email address, but I don&#039;t want them to be able to change it to an email address that&#039;s already in the database as that would cause problems when they try to login.<BR><BR>This is what I have so far for my sql query.<BR><BR>strSQL = "SELECT * FROM UserInfo WHERE Email_Address=&#039;" & email_address & "&#039; AND UserInfoID&#060;&#062;&#039;" & UserInfoID & "&#039;"<BR><BR>UserInfoID is the primary key for the UserInfo table. If the user doesn&#039;t change their email address then when the form submits it&#039;ll submit their existing email address. I don&#039;t want this query to catch their own email address if they haven&#039;t made a change, I just want it to match any other email address in the database if they are attempting to change their email address. If anything is returned by this query I raise an error message...<BR><BR>if not rs.EOF then<BR>errormsg = "This email address is already taken. Please use another one."<BR>end if<BR><BR>Am I going about this in the right way? Thanks in advance. :)

  2. #2
    Join Date
    Dec 1969

    Default RE: sql query question

    I quess you going in the right direction!<BR><BR>Hmmm if the email is already in the DB then *they* must have registered with it so you error message is not Quite correct!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts