Does ADO return a Return Code from .Execute

Hi,

I am inserting rows into a MySQL DB from VB6 using ADO and was wondering if the .Execute method returns a Return Code after execution.  Here are my code snippets:

Dim MySQLConn As New ADODB.Connection
wTestName = txtTestName.Text
InsertString = "Insert into ProductCert.tests (test_name) value ('" & wTestName & "')"
MySQLConn.Execute(InsertString)

Can I code the .Execute as such:
rc = MySQLConn.Execute(InsertString)
and expect a RC to be returned?  If so, what should the data type of rc be?

Thanks!
Andy
LVL 2
abruskoAsked:
Who is Participating?
 
SStoryConnect With a Mentor Commented:
The Execute method returns a Recordset object.  There is an optional second parameter (a long) that can be passed in (by reference) to be set to how many records the query affected.

to catch errors, place an On Error Goto, before you execute.

Inside the error handling code, you can acess
MYSQLConn.Errors (an error collection)
0
 
abruskoAuthor Commented:
"SS",

Thanks for the info, this should help.

Just curious...what is returned in the recordset object on an Insert or Update SQL statement?

andy
0
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
on insert/update/delete, the execute does returns a closed recordset eventually, or rather nothing.
only during select, and eventually during a execute procedure, in case those have selects.
0
 
abruskoAuthor Commented:
Thanks for the info guys!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.