Hey all.
It's been a very long time since i touched any VB Script, but I found myself having to use it the other day, unfortunately my ability to actually write working code seems to be non existant.
I have a mail server that uses VBScript as it's main scripting language and put together this code:
Sub OnDeliveryFailed(oMessage, sRecipient, sErrorMessage)
'This line writes to a log file, works beautifully
EventLog.Write(sRecipient & vbTab & sErrorMessage)
'None of this seems to work, and i'm unsure where from
Set objConnection = CreateObject("ADODB.Connection")
'trying to establish connection
objConnection.Open _
"Provider=SQLOLEDB;Data Source=(An IP address 1.1.1.1);" & _
"Trusted_Connection=Yes;Initial Catalog=a_catalog;" & _
"User ID=backend;Password=p@ssword;"
Set objRecordset = CreateObject("ADODB.Recordset")
Dim obDatabase, bounceMsg
Set obDatabase = GetDatabaseObject
Set bounceMsg = CreateObject("hMailServer.Message")
'trying to insert a record into my audit table, is this where i am going wrong?
objRecordset.Open "insert into newsletterAudit (auditReason, auditDate) values (sRecipient&'-'& sErrorMessage, &'GETDATE()'&)"
End Sub
It writes the eventlog but doesn't write the data to my database table. Is there anything obvious that I'm doing wrong?
Cheers
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.