VBScript format database query to HTML

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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

.



Relevant Pages

  • Re: Getting entries from an SQL database with datetime parameter
    ... format is what you want. ... funtion to convert date string into date time accordig to your needs. ... your database, you will run into troubles comparing date to string. ... > hard coded a query to populate the datagrid, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: DateTime field showing unwanted Time
    ... The time portion is 12:17:04 AM regardless of what table or database I open. ... If I run a query on a date field and convert it to a double format, ... the system automatically changes my ...
    (microsoft.public.access.setupconfig)
  • Re: out-of-range data error (2147217913)
    ... SQL statement with this date? ... > SQL Server 2000 database. ... > settings are OK, users are set to "British English", and if you query ... you seem to have to use mm/dd/yyyy format in the ...
    (microsoft.public.vb.database.ado)
  • Re: Make Table Query
    ... I have 300 users of the database; however, 10 of the users need to enter the ... Delete Query for "temp" Table. ... If you want to control the format, ...
    (microsoft.public.access.queries)
  • Re: text fields null value
    ... This is just to test the query which works fine. ... The part I'm having problems with is where the HTML link actually sends the ... User searches the database using the search form ... The user clicks on one of these links - Say Tower Bridge. ...
    (alt.php)