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. ADODB recordset

ADODB recordset

Scheduled Pinned Locked Moved Visual Basic
c++databasesysadminhelpquestion
2 Posts 2 Posters 0 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.
  • _ Offline
    _ Offline
    _crs_
    wrote on last edited by
    #1

    hello, I want to send a pointer from my VB client app. to a VC dll the code is : for VB ------- Private Declare Sub GenerateReport Lib "Generator.dll" (ByVal datele As ADODB.Recordset) Private Sub Command1_Click() Dim con As ADODB.Connection Dim rs As ADODB.Recordset c = "PROVIDER=sqloledb;server=romulus;uid=sa;pwd=951;DataBase=SindServLast" Set con = New ADODB.Connection con.Open c Dim s As String s = "select * from T_USR_Useri" Set rs = con.Execute(s) GenerateReport rs End Sub fot VC dll ----------- void GenerateReport(_RecordsetPtr pRs) { pRs->MoveFirst(); CString text; text=(char*)((_bstr_t)pRs->Fields->GetItem((_variant_t)("usr_LoginName"))->Value); } and everything works fine in vc ... the pointer is recived correctly and the text CString is filled ok but after that when my c++ function ends and the execution returns to VB the VB client crushes ... and raise an access violation error in a vb dll ... why ? thanks !!!!!

    R 1 Reply Last reply
    0
    • _ _crs_

      hello, I want to send a pointer from my VB client app. to a VC dll the code is : for VB ------- Private Declare Sub GenerateReport Lib "Generator.dll" (ByVal datele As ADODB.Recordset) Private Sub Command1_Click() Dim con As ADODB.Connection Dim rs As ADODB.Recordset c = "PROVIDER=sqloledb;server=romulus;uid=sa;pwd=951;DataBase=SindServLast" Set con = New ADODB.Connection con.Open c Dim s As String s = "select * from T_USR_Useri" Set rs = con.Execute(s) GenerateReport rs End Sub fot VC dll ----------- void GenerateReport(_RecordsetPtr pRs) { pRs->MoveFirst(); CString text; text=(char*)((_bstr_t)pRs->Fields->GetItem((_variant_t)("usr_LoginName"))->Value); } and everything works fine in vc ... the pointer is recived correctly and the text CString is filled ok but after that when my c++ function ends and the execution returns to VB the VB client crushes ... and raise an access violation error in a vb dll ... why ? thanks !!!!!

      R Offline
      R Offline
      RichardGrimmer
      wrote on last edited by
      #2

      My be due to passing the object by value rather than reference (but no promises!) Try : GenerateReport **ByRef** rs "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

      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