Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. [Q] ADO Recordset Events in VB6

[Q] ADO Recordset Events in VB6

Scheduled Pinned Locked Moved Visual Basic
databasemysqlquestion
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Derek Price
    wrote on last edited by
    #1

    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

    H 1 Reply Last reply
    0
    • D Derek Price

      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

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      MySql 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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups