468,285 Members | 1,589 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,285 developers. It's quick & easy.

Passing Recordset from C# to VBScript

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

using ADODB;

[InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)]
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);

public class PSIHeader:iInterface
//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,

return rs;

I have been using regasm to register the type library.

Mar 28 '07 #1
0 1138

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Dthmtlgod | last post: by
18 posts views Thread by Darryl Kerkeslager | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.