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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending email with data from asp conn SQL database

Status
Not open for further replies.

moley

IS-IT--Management
Mar 26, 2002
95
GB
Help,

I'm trying to capture the records on my asp page and email as a htm file. The problem is that the records are stored on the server. What's the best way to do this? do I have tpo create a file from my asp then attach?????

Please advise if u can.
Ta.
 
Hi

No, nothing that grand (though you can if it floats your boat)

Pull your data from the database using a recordset then loop through the recordset creating one long piece of html code with all your records in it. But, instead of writing them to the screen, add them to a variable. This variable can then be used as the content of your body of the email.

If this is a bit of a jump for you (I am not sure how advanced you are on asp and CDONTS) then just reply with more questions. Derren
[Mediocre talent - spread really thin]
 
Cheers for that. I'll have a crack tomorrow.
 
Derren,

I've got my recordset from the db, but i'm not sure about the code to loop through creating the html.

Could you give me some pointers please.

Cheers

Moley
 
Code:
htmlvar = ""
While Not recordset.EOF
   htmlvar=htmlvar & &quot;<h1>&quot; & recordset(&quot;field&quot;) & &quot;</h1>&quot; & vnbCrLf
   htmlvar=htmlvar & &quot;<p>&quot; & recordset(&quot;field2&quot;) & &quot;</p>&quot; & vnbCrLf
   
   ' etc etc
   recordset.movenext()
Wend %>

The secret of success is to create the html in a page first using this and tweak it until you are happy with the html formatting. So rather than sending the email in test mode yo ujust write the htmlvar out into the page. Derren
[Mediocre talent - spread really thin]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top