Does ADO return a Return Code from .Execute


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 & "')"

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?

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)
abruskoAuthor Commented:

Thanks for the info, this should help.

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

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.
abruskoAuthor Commented:
Thanks for the info guys!
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.