I have the following procedure call in VB6:
dim rs as adodb.command
dim cnn as adodb.connection
with rs
set .activeconnection = cnn
.CommandType = adCmdStoredProc
.CommandText = "sp_qryUpdate"
.CommandTimeout = 0
.Parameters("@uidbatch").value = lngBatchID
.Execute , , adExecuteNoRecords
end with
I receive the error of,
Object variable or with block variable not set
The error is thrown after the .activeconnection is set
Any ideas what this means? The connection string I’m receiving is correct.
Strange,
rsis normally used to indicate a record set rather than a command but to each their own, I guess.I see some potential issues. I’m not entirely certain of the difference since my exposure to VB6 was pleasantly brief but all the code I did had:
in it (i.e., with the
newkeyword). That may be causing a problem.I also assume you have some code between that second
dimand thewith, yes?Because otherwise, you’re not actually opening a connection for use.
There’s some tutorial code here which may be of assistance. I’d say “Enjoy!” but I don’t think that’s an option 🙂