Dear readers,

We are trying to use the VBscript Action to insert some details into a SQL after which we can automaticlly generate a support ticket. But it seems my best days of VBscriptin is over and i keep having an issue.

 Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open _
    "Provider=SQLOLEDB;Data Source=nlvensq01;" & _
        "Trusted_Connection=Yes;Initial Catalog=Synergy;" & _
             "User ID=pentair\svc_admin;Password=Blabla;"

objConnection.Execute "INSERT INTO dbo.Servermonitoring(Datum, Computer, Monitortype, Title, Details) VALUES (Date, Machine, MonitorType, MonitorTitle, Details)"

The code used can be seen above. This gives the error that Date is not a correct Syntax (But its the variable used by PA Monitor) If i replease the VALUES string with (Clear text instead of the PA Variables)

VALUES ('31-10-2012', 'Machine', 'MonitorType', 'MonitorTitle', 'Details')

Basiclly this script runs everytime a monitor is in error for 5 minutes and inserts Date string, Machine name Monitor type, MonitorTitle and the Error Details to a SQL table which is being used by our Workflow tool. it inserts what i want it to. Can anyone advise on what i am doing wrong in this case?

Regards, Mike Sternfeld

asked 31 Oct '12, 05:29

Msternfeld's gravatar image

Msternfeld
160112
accept rate: 0%


I think you probably need to change it to:

VALUES ('" + Date + "', '" + Machine + "', '" + MonitorType + "', '" + MonitorTitle + "', '" + Details + "')"

link

answered 03 Nov '12, 10:18

Doug's gravatar image

Doug ♦♦
10.1k112037
accept rate: 23%

edited 03 Nov '12, 11:47

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×17
×4
×1

Asked: 31 Oct '12, 05:29

Seen: 44,740 times

Last updated: 03 Nov '12, 11:47