[Q] ADO Recordset Events in VB6
-
Hello, I am inserting a Recordset using a SQL statement, but when I call Open(), none of the Recordset Events fire (WillChangeRecordset, RecordsetChangeComplete, etc.). If I use the same Recordset with the same connection but change the Source to a new SQL statement, and call Open() again - all the Events fire.
Public WithEvents rs As ADODB.Recordset 'conn is a valid ADO connection conn.Open 'MySql is a valid insert command independently tested 'The database is updated with the new record, but no Events fire rs.Open MySql, conn, , , adCmdText 'Set new valid SQL rs.Source = "SELECT MyTable.ID from MyTable WHERE ID = 5" 'Opening this fires all the Recordset Events rs.Open , , , , adCmdText rs.Close
Any ideas why the first Open() fires no events and the second fires all the events? Thanks is Advance! Derek -
Hello, I am inserting a Recordset using a SQL statement, but when I call Open(), none of the Recordset Events fire (WillChangeRecordset, RecordsetChangeComplete, etc.). If I use the same Recordset with the same connection but change the Source to a new SQL statement, and call Open() again - all the Events fire.
Public WithEvents rs As ADODB.Recordset 'conn is a valid ADO connection conn.Open 'MySql is a valid insert command independently tested 'The database is updated with the new record, but no Events fire rs.Open MySql, conn, , , adCmdText 'Set new valid SQL rs.Source = "SELECT MyTable.ID from MyTable WHERE ID = 5" 'Opening this fires all the Recordset Events rs.Open , , , , adCmdText rs.Close
Any ideas why the first Open() fires no events and the second fires all the events? Thanks is Advance! DerekMySql is a valid insert command independently tested I think first open doesn't fire events because it does not change the rs it just inserts records in the DB but the second is a select satement that changes the rs