I wrote VBasic the query to MSSQL gives out a mistake in job - "Response not wellformed: "(C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\Demo VBScript.vbs(10, 30) Microsoft VBScript compilation error: Expected end of statement )" (code: PE132)"
Imports System Imports System.Data.OleDb Imports System.Data.SqlClient Module Module1 Sub Main() Dim ConnectionString As String = "Persist Security Info=True;Data Source=10.1.0.142;Initial Catalog=master;Trusted_Connection=true;" Using Connection As New SqlConnection(ConnectionString) Connection.ConnectionString = ConnectionString Connection.Open() Dim sSQL As String = "select sum(s_mf.size)*8/1024 " _ & "FROM sys.master_files s_mf " _ & "WHERE db_name(s_mf.database_id) IN ('prtg');" Dim objCmd As New SqlCommand(sSQL, Connection) objCmd.ExecuteNonQuery() Connection.Close() End Using End Sub End Module
As it is correct to write inquiry to SQL to VBA-job?
Add comment