Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REmail

Status
Not open for further replies.

Goog

MIS
Mar 12, 2002
6
US
Can all of u please help to check wheher the following code is correct? The purpose of the code is that it will enable to user to know their password when they type in their email.

But they gave me this error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'from'.

/mailpwd1.asp, line 28



<%Option Explicit%>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
</HEAD>
<BODY>


<%

Dim DataConn, ConnString
Dim SQL, myEmail, oRs
Dim Email2, password2
Dim MyMail

myEmail=Request.Form (&quot;text1&quot;)

Set DataConn = Server.CreateObject(&quot;ADODB.Connection&quot;)

ConnString=&quot;driver={sql server};server=CON7; database=user;DSN=localserver;PWD=sa;UID=sa;&quot;
DataConn.Open ConnString

SQL=&quot;select * from password, email from info where email='&quot; & myEmail &&quot;'&quot;


Set oRs= Server.CreateObject (&quot;ADODB.recordset&quot;)
oRs.Open SQL, DataConn, 3 line 28


If oRs.EOF Then
response.write &quot;<html><head><body bgcolor='#000000' text='#ffff00'><center>&quot;
Response.Write &quot;<font face='verdana' size='+2'><p>&quot;
Response.Write &quot;No records found:<p> Use the browser's back button to go back and try again&quot;
Response.Write &quot;</font></body></html>&quot;
Response.End
end if

Email2=oRs(&quot;myEmail&quot;)
password2=oRs(&quot;password&quot;)


oRs.Close
Set oRs=nothing

Set MyMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

MyMail.From=&quot;yoursys@system.com&quot;
MyMail.To = Email2
MyMail.Subject =&quot;Your Password&quot;
MyMail.Body= password2

MyMail.Send
Set MyMail= nothing
%>


Thank you!!
X-)
 
format for sql select statement should be:

SQL=&quot;select password, email from info where email='&quot; & myEmail &&quot;'&quot;
 
I solve the problem already but it shows that
No records found:

Use the browser's back button to go back and try again
. May i know what is wrong with it?


Thank You X-)

 
do a response.write after

myEmail=Request.Form(&quot;text1&quot;)
response.write myEmail

to see if you there's any value in myEmail.

is text1 the exact fieldname in your form? is method=post in your form tag? (if not, then there's nothing in request.form....)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top