newbie problem w/ calling Oracle proc in .NET

J

Jason Shohet

I have the below code, that executes a Oracle proc returning a ref-cursor.
It works FINE when I run the proc by itself in Oracle :) But when I call
it from my code-behind page, I get this crazy .NET error,
"No error information available: REGDB_E_CLASSNOTREG(0x80040154)"

Hehe. Nice helpful message there Microsoft. Anyhow my code is below. The
1st parameter when I create the OleDbCommand, and also the 1st param when I
create the sda, is the 'selectcommandtext' argument. I know usually you
put the select statement in there. Since I'm calling a proc, do i leave
that as "" for both? Or do I need to put something else in the 1st param,
say, when I create the SDA? Also, I got that connection string stuff off
the web somewhere & just put my own userid / datasource / password in there.
The other stuff, I'm not sure what it is or if its right ;) Thanks for any
help!!
DataSet ds = new DataSet();

OleDbConnection con = new OleDbConnection();

con.ConnectionString = "Provider=OraOLEDB.Oracle.1;Persist Security
Info=False; User ID=wc; Password=wcabc; Data
Source=WPRP;PLSQLRSet=1;Extended Properties=\"\"";

OleDbCommand cmd = new OleDbCommand("", con);

cmd.CommandType = CommandType.StoredProcedure ;

cmd.CommandText = "pkg_get_bldgs.PCOC_PREMISYS_BLDG_CNTCT";

cmd.Parameters.Add("@AN_BLDG_ID","693"); // PASSING IN A VALUE AS A PARAM

OleDbDataAdapter sda = new OleDbDataAdapter("", con);

sda.SelectCommand = cmd;

sda.Fill(ds, "ADDRESS"); // IT BLOWS UP HERE

dg1.DataSource = ds.Tables[1];
 
D

David Browne

Jason Shohet said:
I have the below code, that executes a Oracle proc returning a ref-cursor.
It works FINE when I run the proc by itself in Oracle :) But when I call
it from my code-behind page, I get this crazy .NET error,
"No error information available: REGDB_E_CLASSNOTREG(0x80040154)"

Hehe. Nice helpful message there Microsoft.

It's an OleDb error, and you shouldn't be using OleDb in the first place.


You need to use one of the native oracle providers to use ref cursors.
Either ODP.NET from Oracle (http://otn.oracle.com) or the
System.Data.OracleClient from MS.

David
 
J

Jason Shohet

TY David. I've begun using the OracleConnection thing from Microsoft, and
I'm much further now. I just posted a new posting on some problems I'm
having though, trying to do ExecuteReader in the code... its failing.
TY -- Jason Shohet
 

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