Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ASP.NET ControlParameter as parameter for OracleCommand object?

mateoc15Jul 6 2009 — edited Jul 6 2009
I have something similar to the information below:

OracleCommand oraCmd = new OracleCommand("insert into my_table (field1, field2) values (:Param1, :Param2)", new OracleConnection(ConfigurationManager.ConnectionStrings["fsgebs"].ConnectionString));
oraCmd.Parameters.Add("Param1", ### I want to use a ControlParameter from the web form here ###);
oraCmd.Parameters.Add("Param2", ### I want to use a ControlParameter from the web form here ###);

I have a web form with about 20 fields and I don't really want to manually do all of this. ControlParameter would be ideal.

Can anyone explain how I can do this? Will I need casting? Obviously I'm using C# here, but if someone has a VB example that might help.

I have tried each of the three lines below with no luck.
OracleParameter p = (Parameter)(new ControlParameter("Field1", "wizCreateRequest$txtItemNumber"));
OracleParameter p = (OracleParameter)(new ControlParameter("Field1", "wizCreateRequest$txtItemNumber"));
OracleParameter p = new ControlParameter("Field1", "wizCreateRequest$txtItemNumber");

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2009
Added on Jul 6 2009
1 comment
2,135 views