473,473 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

program against Oracle

Can anyone point me to some example ASP.NET apps that use Oracle has a backend and C# as the language?

I need to figure out how to populate a drop down, and then a datagrid depending on what the user selected in the drop down box.
thx
Nov 16 '05 #1
3 2650
What you'll need first is the Oracle data provider either from Oracle or from Microsoft. All the C# code will look the same with the exception that the namespace is System.Data.OracleClient instead of System.Data.Sql. I believe there are code examples with both of these providers. But to get you started...

Instead of creating Sql* objects you create Oracle* objects.

If you plan to use Oracle stored procedures to return record sets you'll need to look up how to return "ref cursors" from Oracle.

It looks something like this, declare a type:
type myCursorType is ref cursor;

Your Oracle procedures will return this cursor type:
procedure MyProc(outData out myCursorType)

To return the recordset from within the Oracle stored procedure use:
open outData for "your select statement"

Now for C# code.

Unlike SqlServer stored procedures you have to setup an out parameter in your Command object's parameter collection to hold the recordset.
OracleParameter outData = new OracleParameter("outData", OracleType.Cursor);
outData.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(outData);

Create your OracleDataAdapter and fill your dataset like you would if you were using SqlDataAdapters.

HTH

--
C Addison Ritchie, MCSD
Ritch Consulting, Inc.
"IGotYourDotNet" wrote:
Can anyone point me to some example ASP.NET apps that use Oracle has a backend and C# as the language?

I need to figure out how to populate a drop down, and then a datagrid depending on what the user selected in the drop down box.
thx

Nov 16 '05 #2
I have the oracle data provider, i currenlty have the app in VB.NET i want to convert it over to C#.
is there some example code on this? I created C# code to connect to the DB and that works fine, and i also have my drop down populated, now how can i populate the grid depending on what the user selected from the drop down?
In C#

"C Addison Ritchie" wrote:
What you'll need first is the Oracle data provider either from Oracle or from Microsoft. All the C# code will look the same with the exception that the namespace is System.Data.OracleClient instead of System.Data.Sql. I believe there are code examples with both of these providers. But to get you started...

Instead of creating Sql* objects you create Oracle* objects.

If you plan to use Oracle stored procedures to return record sets you'll need to look up how to return "ref cursors" from Oracle.

It looks something like this, declare a type:
type myCursorType is ref cursor;

Your Oracle procedures will return this cursor type:
procedure MyProc(outData out myCursorType)

To return the recordset from within the Oracle stored procedure use:
open outData for "your select statement"

Now for C# code.

Unlike SqlServer stored procedures you have to setup an out parameter in your Command object's parameter collection to hold the recordset.
OracleParameter outData = new OracleParameter("outData", OracleType.Cursor);
outData.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(outData);

Create your OracleDataAdapter and fill your dataset like you would if you were using SqlDataAdapters.

HTH

--
C Addison Ritchie, MCSD
Ritch Consulting, Inc.
"IGotYourDotNet" wrote:
Can anyone point me to some example ASP.NET apps that use Oracle has a backend and C# as the language?

I need to figure out how to populate a drop down, and then a datagrid depending on what the user selected in the drop down box.
thx

Nov 16 '05 #3
The code for C# should be almost identical to the VB code. The biggest difference will be how the event is wired up to code. All the other code dataGrid.DataBind() etc... should be the same, assuming you're using data binding. Another difference you may encounter is array indexers:
C#: []
VB: ( )

For event wiring the easiest thing to do is right click on the combobox and select properties. In the properties box click on the lightning bolt button. In the SeletedIndexChanged event type in the name of the method that will be called when the event fires. When you hit return the IDE will take back to the code window with a method set up and ready to code.

If you wish to see how the event is actually wired to the method expand the "Windows Form Designer generated code" region. In the InitializeComponent method you'll see something like:
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.Test);

I hope this gets you a little closer to where you want to go.

--
C Addison Ritchie, MCSD
Ritch Consulting, Inc.
"IGotYourDotNet" wrote:
I have the oracle data provider, i currenlty have the app in VB.NET i want to convert it over to C#.
is there some example code on this? I created C# code to connect to the DB and that works fine, and i also have my drop down populated, now how can i populate the grid depending on what the user selected from the drop down?
In C#

"C Addison Ritchie" wrote:
What you'll need first is the Oracle data provider either from Oracle or from Microsoft. All the C# code will look the same with the exception that the namespace is System.Data.OracleClient instead of System.Data.Sql. I believe there are code examples with both of these providers. But to get you started...

Instead of creating Sql* objects you create Oracle* objects.

If you plan to use Oracle stored procedures to return record sets you'll need to look up how to return "ref cursors" from Oracle.

It looks something like this, declare a type:
type myCursorType is ref cursor;

Your Oracle procedures will return this cursor type:
procedure MyProc(outData out myCursorType)

To return the recordset from within the Oracle stored procedure use:
open outData for "your select statement"

Now for C# code.

Unlike SqlServer stored procedures you have to setup an out parameter in your Command object's parameter collection to hold the recordset.
OracleParameter outData = new OracleParameter("outData", OracleType.Cursor);
outData.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(outData);

Create your OracleDataAdapter and fill your dataset like you would if you were using SqlDataAdapters.

HTH

--
C Addison Ritchie, MCSD
Ritch Consulting, Inc.
"IGotYourDotNet" wrote:
Can anyone point me to some example ASP.NET apps that use Oracle has a backend and C# as the language?

I need to figure out how to populate a drop down, and then a datagrid depending on what the user selected in the drop down box.
thx

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rick | last post by:
I'm having problems with EnterpriseServices transactions running against Oracle 9iR2. I am inconsistently getting Oracle ORA-24761: Transaction Rolled Back results mid-transaction. If I start...
0
by: Error while executing SP | last post by:
Hi, I am getting "Unspecified error" using(System.Data.OleDb.OleDbConnection cn = new System.Data.OleDb.OleDbConnection()) {...
0
by: otto | last post by:
Hi, all: We have a Windows application that make operations against an Oracle database. The business logic components are in the server and are accesible from the client interface trought a...
0
by: Moistly | last post by:
Hi All, I am wanting to automate adding files to VSS from an ASP.NET page, without any luck. I have tried SourceSafeTypeLib dll with no luck. I have managed to created a VssWebService on a...
2
by: yoram.ayalon | last post by:
we are deploying a ASP.NET 2.0 web application (written in vb.net) to a windows Server 2003 web edition in which .NET framework 2.0 has been instaled. the application connects to an Oracle 9i...
1
by: pallavia84 | last post by:
i am trying to connect my java program to oracle but i am nt able to do that . please help me to do that
4
by: abuasab | last post by:
how can run executable application from oracle trigger or procedure.
2
by: mkotula | last post by:
Hi, Brand new to jasper and IReport with Oracle. Was able to load and connect IReport to Oracle DB and created my first reports. Unable to connect Jasper to the DB nor import my IReport...
0
by: pjbr34 | last post by:
Hi all, The problem is this: Oracle table with NUMBER datatype is migrated into DB2 as DECIMAL. No problem. BUT The Java application that processes the data using Eclipse or WebLogic is...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.