ODP.NET simple procedure call example?

  • Thread starter Thread starter Dominic
  • Start date Start date
D

Dominic

There are many examples out there of how to do SQL or REF CUR's for
ODP.NET. I can't for the life of me find an ASP/VB example of a
straight procedure call, nothing fancy. I think I'm close, but I
can't figure out how to get the values from the output parameters.
Anybody have a working example? Much appreciated.
 
(e-mail address removed) (Dominic) wrote in @posting.google.com:
There are many examples out there of how to do SQL or REF CUR's for
ODP.NET. I can't for the life of me find an ASP/VB example of a
straight procedure call, nothing fancy. I think I'm close, but I
can't figure out how to get the values from the output parameters.
Anybody have a working example? Much appreciated.

Just add the parameters like command.Parameters.Add(new
OracleParameter(...)) and after the call use an index in the Parameters
collection of teh command you executed to retrieve the value:
int value = command.Parameters[0].Value;

ODP.NET doesn't support named parameters, so you have to add the
parameters in the same order as you specify them in your query. For the rest
I don't know why it can be that hard, simply because working with the
parameters is the same as working with the SqlClient parameters.

FB
 
Frans Bouma said:
(e-mail address removed) (Dominic) wrote in @posting.google.com:
There are many examples out there of how to do SQL or REF CUR's for
ODP.NET. I can't for the life of me find an ASP/VB example of a
straight procedure call, nothing fancy. I think I'm close, but I
can't figure out how to get the values from the output parameters.
Anybody have a working example? Much appreciated.

Just add the parameters like command.Parameters.Add(new
OracleParameter(...)) and after the call use an index in the Parameters
collection of teh command you executed to retrieve the value:
int value = command.Parameters[0].Value;

ODP.NET doesn't support named parameters, so you have to add the
parameters in the same order as you specify them in your query. For the rest
I don't know why it can be that hard, simply because working with the
parameters is the same as working with the SqlClient parameters.

FB

Frans,

Thanks for the reply, I was trying to access the parameter by name.
Using the index worked, but the obvious question now is: What then, is
the purpose of the OracleParameter.ParameterName property?

Dominic.
 
There are many examples out there of how to do SQL or REF CUR's for
ODP.NET. I can't for the life of me find an ASP/VB example of a
straight procedure call, nothing fancy. I think I'm close, but I
can't figure out how to get the values from the output parameters.
Anybody have a working example? Much appreciated.
Look in the oracle/odp.net directory. There is one called samples.
They're C# I think but the principles are the same.
 
Back
Top