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. C#
  4. Passing Recordset from C# COM to VBScript

Passing Recordset from C# COM to VBScript

Scheduled Pinned Locked Moved C#
databasequestioncsharpcomsysadmin
1 Posts 1 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.
  • R Offline
    R Offline
    rahvyn6
    wrote on last edited by
    #1

    I am working on a COM dll in C# that needs to pass an ADODB recordset back to the calling VBScript. I believe I have everthing setup correctly, as the calls work, and it looks like a recordset is returned, however, the recordset is null or closed. What is the trick to passing a recordset back from C#? The Call: Set rs = CreateObject("Interface") rs.Init "System", "ODBC", "user", "pass", "database", "server" retVal = rs.DataImport("value") C#: using ADODB; [Guid("C3C26A94-9639-43c4-B59C-E245C8A68D44")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface iInterface { [DispId(1)] bool DataExport(string OrderNumber, string TrackingNumber, decimal Freight, decimal Weight, string ShipDate, string ShipVia, string MiscNum); [DispId(2)] bool DataVoid(string OrderNumber, string TrackingNumber, decimal Freight, decimal Weight, string MiscNum); [DispId(3)] Recordset DataImport(string OrderNumber); [DispId(4)] void Init(string nameVal, string odbcVal, string userVal, string passVal, string dbVal, string srvVal); } [Guid("EF8369F0-CF42-40b1-B3F3-0EC54CE73FF4")] [ClassInterface(ClassInterfaceType.None)] [ProgId("Interface")] public class PSIHeader:iInterface { public Recordset DataImport(string OrderNumber) { //misc stuff - create connection, query etc... //Recordset creation and return rs.CursorLocation = CursorLocationEnum.adUseClient; rs.Open(query.ToString(), cn, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockOptimistic, -1); return rs; } } I have been using regasm to register the type library. Thanks

    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