Recordsets and Ref Cursors

G

Guest

I am passing an ADODB.Recordset (rs) into a .Net C# dll. I need to fill a
dataset using Oracle.DataAccess.Client.DataAdaptor.

OracleDataAdapter da = new OracleDataAdapter();
DataSet ds = new DataSet();
DataTable dt = new DataTable();
da.Fill(dt, rs);

This does not work. I need to use:
da.Fill(dt, ref cursor);

How do I convert the recordset (rs) to a ref cursor?

Thanks....
 
P

Paul Clement

On Tue, 28 Dec 2004 12:59:03 -0800, "Marathoner"

¤ I am passing an ADODB.Recordset (rs) into a .Net C# dll. I need to fill a
¤ dataset using Oracle.DataAccess.Client.DataAdaptor.
¤
¤ OracleDataAdapter da = new OracleDataAdapter();
¤ DataSet ds = new DataSet();
¤ DataTable dt = new DataTable();
¤ da.Fill(dt, rs);
¤
¤ This does not work. I need to use:
¤ da.Fill(dt, ref cursor);
¤
¤ How do I convert the recordset (rs) to a ref cursor?

Could you expand on this a bit? Why do you need a ref cursor?

In addition, can we assume you're passing the ADODB Recordset to the C# DLL by
value and not by ref?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
G

Guest

I am sorry for my ignorance but this is new to me. I assume I need a ref
cursor since the Fill method of the Oracle.DataAccess.Client.DataAdaptor will
not take a recordset as a parameter but will take a ref cursor as a
parameter. I will admit to struggling with this issue of trying to make a
VB6 app work with our .Net code. Yes, I am passing the recordset by value
and not by ref. The dataset will be passed into an Oracle stored proc so I
thought it best to use the Oracle.DataAccess.Client.DataAdaptor. The
OleDbDataAdaptor's Fill method does take a recordset as a parameter but I do
not know if I can pass that dataset into the Oracle stored proc.

THANKS FOR YOUR REPLY....
 
P

Paul Clement

¤ I am sorry for my ignorance but this is new to me. I assume I need a ref
¤ cursor since the Fill method of the Oracle.DataAccess.Client.DataAdaptor will
¤ not take a recordset as a parameter but will take a ref cursor as a
¤ parameter. I will admit to struggling with this issue of trying to make a
¤ VB6 app work with our .Net code. Yes, I am passing the recordset by value
¤ and not by ref. The dataset will be passed into an Oracle stored proc so I
¤ thought it best to use the Oracle.DataAccess.Client.DataAdaptor. The
¤ OleDbDataAdaptor's Fill method does take a recordset as a parameter but I do
¤ not know if I can pass that dataset into the Oracle stored proc.
¤

If you use the native ADO.NET you won't be able to populate an ADODB Recordset directly. There are
two alternatives:

1) Use ADO via interop (with the Command object) and connect via ODBC or OLEDB. This code would
likely be similar to what you have in your VB 6.0 application.

2) Populate a DataSet using the stored procedure and then move the data from the DataSet to the
Recordset. The following MS KB articles may help:

How To Retrieve Multiple Ref_cursors from an Oracle Stored Procedure by Using the .NET Managed
Provider For Oracle
http://support.microsoft.com/default.aspx?scid=kb;en-us;321715

How To Convert an ADO.NET DataSet to ADO Recordset in Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;316337


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
P

Paul Clement

¤ Paul,
¤
¤ I dont know all what is in this message thread, however when I saw your
¤ message I had to think on this, it is in my opinon very hidden on MSDN so I
¤ don't know if you know this one and maybe is it helpfull.
¤
¤ http://msdn.microsoft.com/library/d...emdataoledboledbdataadapterclassfilltopic.asp

Cor,

Does this overloaded Fill method copy the contents from a DataTable to an ADO Recordset?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
C

Cor Ligthert

Paul,

No in the opposite way, I only wanted to make you attent on it, as I know it
is very hidden and you are often busy with this. (As I wrote I don't know if
you do know this already)

Nothing more.

Cor
 
P

Paul Clement

¤ Paul,
¤
¤ No in the opposite way, I only wanted to make you attent on it, as I know it
¤ is very hidden and you are often busy with this. (As I wrote I don't know if
¤ you do know this already)
¤
¤ Nothing more.

Yes I know about it but he needs to fill the Recordset from the DataSet and not vice versa. ;-)


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
G

Guest

Hi guys,

I have problem with respect to ref cursor.
My DB ask me to pass data (about 30 fileds) to oracle stored procedure by
ref cursor. Can you help me in this regards..

Jaiganesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top