VBScript format database query to HTML
- From: "JJ" <jen@xxxxxx>
- Date: 31 May 2006 17:36:04 -0700
I'm trying to write a script that will query a database, format the
results into an html table, and then email it.
I've go tthe querying part working, and the email part working, but I
can't find any examples for formatting the query results into a html
form I can send. Every example is ASP, which is different enough to
just muddy the water for me....
Here's what I have:
Dim db
Dim rs
Set db = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
db.Open "Provider=SQLOLEDB; Data Source=datamart; Initial
Catalog=database; User ID=user; Password=password;"
rs.CursorType = 2
rs.LockType = 3
sSQL="SELECT MESSAGE_NO, MESSAGE_TEXT FROM JCTL_JOB_AUDIT ORDER BY
MESSAGE_NO"
rs.Open sSQL, db
If rs.BOF AND rs.EOF Then
Else
rs.MoveFirst
Do until rs.EOF = True
?????? -- somehow put this into bodytxt
rs.MoveNext
Loop
End If
db.Close
Set rs = Nothing
Set db = nothing
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Database Audit Failure"
objMessage.From = "email@xxxxxxxxxx"
objMessage.To = "user@xxxxxxxxxx"
BodyTxt = "test"
objMessage.htmlBody = BodyTxt
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.domain.com"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
.
- Follow-Ups:
- Re: VBScript format database query to HTML
- From: Tim Williams
- Re: VBScript format database query to HTML
- Prev by Date: Transfer values from one form to the other
- Next by Date: Re: RecordSet fails if a field is null ! - unspecified error '80004005'
- Previous by thread: Transfer values from one form to the other
- Next by thread: Re: VBScript format database query to HTML
- Index(es):
Relevant Pages
|