"Forgotten Password" Code

Results 1 to 5 of 5

Thread: "Forgotten Password" Code

  1. #1
    Machine Guest

    Default "Forgotten Password" Code

    Hello,<BR>The below code is called "sendit.asp". It utilizes 2 tables in the one database. I get the following error when I enter a known, in the database, email address into "forgot_password.htm" page:<BR><BR> ADODB.Fields error &#039 800a0cc1&#039 <BR><BR> ADO could not find the object in the collection <BR> corresponding to the name or ordinal reference <BR> requested by the application. <BR><BR> /TEST/sendit.asp, line 221 <BR><BR>If I enter a ficticious email, all goes as as planned.<BR><BR>Any suggestions for the below code?<BR><BR>Thank You In Advance<BR><BR>---sendit.asp below-----<BR><BR>&#060;%@ LANGUAGE="VBSCRIPT" %&#062;<BR>&#060;% Option Explicit %&#062;<BR>&#060;% <BR>Dim DATA_PATH, objDC, objRS, Email, userID, password, sendmail<BR> &#039Maps to database. Change to your database path.<BR>DATA_PATH=Server.Mappath("MyDatabase.mdb" )<BR> &#039 Create and establish data connection<BR>Set objDC = Server.CreateObject("ADODB.Connection")<BR>objDC.C onnectionTimeout = 15<BR>objDC.CommandTimeout = 30<BR>objDC.Open Application("MyDatabase_ConnectionString")<BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR>email=re quest.form("email")<BR> &#039you may need to adjust this to suit your database<BR>objRS.Open "SELECT Contacts.email FROM Contacts WHERE " &_<BR> "email =&#039" & Email & "&#039"&_<BR> " UNION "&_<BR> "SELECT mgtContacts.email FROM mgtContacts WHERE " &_<BR> "email =&#039" & Email & "&#039", objDC, 0, 1<BR>%&#062;<BR><BR>&#060;head&#062;<BR>&#060;titl e&#062;Forgotten Password&#060;/title&#062;<BR>&#060;/head&#062;<BR>&#060;body&#062;<BR><BR>&#060;!--webbot bot="Include"<BR>U-Include="../headers/header.htm"<BR>TAG="BODY" --&#062;<BR><BR>&#060;p&#062;<BR>&#060;%<BR> &#039checks if email address exists in the database before sending a message.<BR>if objrs.EOF then<BR>%&#062;<BR><BR>&#060;p align="center"&#062;<BR>&#060;font face="Arial"&#062;&nbsp;<BR>&#060;B&#062;&#060;fon t color="red"&#062;<BR>There is no account for &#060;%=email%&#062;.&nbsp;<BR>&#060;/font&#062;&#060;/B&#062;<BR>&#060;/font&#062;<BR><BR>&#060;p align="center"&#062;<BR>&#060;font face="Arial"&#062;<BR>&#060;B&#062;&#060;font color="red"&#062;<BR>&#060;a href="forgot_password.htm"&#062;<BR>Click Here To Re-Enter Your E-mail Address&#060;/a&#062;<BR>&#060;/font&#062;&#060;/B&#062;<BR>&#060;% Else %&#062; <BR><BR><BR>&#060;%<BR> &#039sets variables<BR>email = request.form("email")<BR> &#039chooses username and password from database that correspond to submitted email address.<BR>userID = objrs.Fields("userID")<BR>password = objrs.Fields("password")<BR>Set sendmail = Server.CreateObject("CDONTS.NewMail")<BR> &#039put the webmaster address here<BR>sendmail.From = "webmaster@myisp.net"<BR> &#039The mail is sent to the address entered in the previous page.<BR>sendmail.To = Email<BR> &#039Enter the subject of your mail here<BR>sendmail.Subject = "The Login Information You Requested"<BR> &#039This is the content of thr message.<BR>sendmail.Body = "The login Information you requested." & vbCrlf & vbCrlf _<BR>& "Your Username is " & userID & vbCrlf _<BR>& "Your Password is " & password & vbCrlf<BR> &#039this sets mail priority.... 0=low 1=normal 2=high<BR>sendmail.Importance = 2<BR>sendmail.Send<BR>%&#062;<BR><BR> Your login information has been mailed to &#060;%=email%&#062;.<BR><BR>You should receive it shortly.<BR>&#060;%<BR> &#039 Close Data Access Objects and free DB variables<BR> objDC.Close<BR> Set objRS = Nothing<BR> Set objDC = Nothing<BR> Set sendmail = Nothing<BR>%&#062;<BR>&#060;%end if%&#062;<BR> &nbsp;&#060;/font&#062;<BR>&#060;hr&#062;<BR>&#060;!--webbot bot="Include"<BR>U-Include="../Footer/footer.htm"<BR>TAG="BODY" --&#062;<BR><BR>&#060;p&#062;&nbsp;&#060;/p&#062;<BR><BR>&#060;p&#062;<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    1,435

    Default RE: Forgotten Password Code

    That error means you&#039ve tried to get a named field from the recordset, but there isn&#039t a field with that name. Double check your field names.<BR><BR>Dunc

  3. #3
    Machine Guest

    Default RE: Forgotten Password Code

    I double checked the field names and they are OK. :(<BR>I have two seperate tables within the database that contain fields userID and password. Can this be the problem?

  4. #4
    Join Date
    Dec 1969
    Posts
    1,435

    Default RE: Forgotten Password Code

    From re-reading your code, the problem is in you SELECT statements - you are only SELECTing the .email field (who&#039s value you already know, because that&#039s in your WHERE clause). You need to SELECT userID, password as well!<BR><BR>Cheers<BR><BR>Dunc


  5. #5
    Machine Guest

    Default RE: Forgotten Password Code ... YYESSS!!

    You Rock!!<BR><BR>That was exactly it.<BR><BR>For any one following this thread, see my original post. The offending section is the sql statement that was to retrieve a particular recordset. The correct statement is:<BR> "SELECT Contacts.email, Contacts.userID, Contacts.Password FROM Contacts WHERE " &_<BR> "email =&#039" & Email & "&#039"&_<BR> " UNION "&_<BR> "SELECT mgtContacts.email, mgtContacts.userID, mgtContacts.Password FROM mgtContacts WHERE " &_<BR> "email =&#039" & Email & "&#039"<BR><BR>I am accessing 2 tables within a database. These two tables are not identical. Therefore I need to "SELECT" the appropriate record set based on the exact information that I am seeking (email, userID, password).<BR><BR>Duncan, I hope I am correct in my observation and thank you so much for your help<BR><BR>M

Posting Permissions

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