Useing a text box to pull from a ddb

G

Guest

hello,
I would like to have a text box pull from a ddb is this possible. I am trying to e-mail the resaults and I know how to use a text box but i cant figure out any other way. her is the script. the mail = request.form("Email") is a text box form the other page but i would like it to pull from the ddb. thanks

<%
DIM strEmail, strName, strComments, mail, reply, objMail
strEmail = request.form("Email")
strName = request.form("FirstName") & vbCrLf & request.form("LastName")
strComments = request.form("Comments")

mail = request.form("Email")
reply = "(e-mail address removed)"
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = reply
objMail.Subject = "Account Info"
objMail.To = mail
objMail.Body = "Email: " & strEmail & vbCrLf & _
"Name: " & strName & vbCrLf & _
"Comments: " & strComments & vbCrLf

objMail.Send
Set objMail = nothing
%><P><%
strName = request.form("Name")
Response.Write strName
%>Thank you, you will receive your account info soon.</P>
 
J

Jim Buyens

-----Original Message-----

Howdy.

Your question (below) lacks quite a few details, but
here's some sample code that retrieves information from a
database.

Dim conMyDb
Dim rstQry
Dim strSql
Dim strMyVal
Set cnMyDb = Server.CreateObject("ADODB.Connection")
cnMyDb.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & _
Server.MapPath("fpdb/my.mdb") & ";"

strSql = "SELECT * FROM mytable " & _
"WHERE mykey = '" & request("myfield") & "' "
set rstQry = Server.CreateObject("ADODB.Recordset")
rstQry.Open strSql, cnMyDb, 1, 1
if rstQry.eof then
strMyVal = "Key '" & request("myfield") & "' not found."
else
strMyVal = rstQry("myfield")
end if
rstQry.Close
cnMyDb.Close

Of course, you would have to modify the database file
location, the table and field names, the source of the
lookup value, and so forth.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------


I would like to have a text box pull from a ddb is this
possible. I am trying to e-mail the resaults and I know
how to use a text box but i cant figure out any other way.
her is the script. the mail = request.form("Email") is a
text box form the other page but i would like it to pull
from the ddb. thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top