Does anyone have an example query to run against an slx db? I’m getting an error using the following:
Set objConn = CreateObject(“ADODB.Connection”)
Set objCmd = CreateObject(“ADODB.Command”)
Set objRS = CreateObject(“ADODB.Recordset”)
objConn.ConnectionString = “Provider=SLXOLEDB.1;Integrated Security=True;Initial Catalog=slxcat;Data Source=myslxserver;Extended Properties=PORT=1706;LOG=ON;Location=;Mode=ReadWrite”
objCmd.CommandText = “SELECT * FROM TICKET WHERE TICKETID=’001-00-025850′”
While Not objRS.EOF
Set objRS = Nothing
Set objCmd = Nothing
Set objConn = Nothing
But I get an error: Run-time error ‘3709’: The connection cannot be used to perform this operation. It is either closed or invalid in this context.
The error message that you are getting is because you are never opening a connection.
After you set the ConnectionString property, you need to open the connection:
Towards the end you have remembered to “close” the connection, but as stated, you never opened it to begin with.