Tay Johnson
asked on
Learning Processes involved in building a asp.net mvc (C#) application that uses an Oracle database
I am new to asp.net mvc (C#) and I am using an Oracle 9i database
I am looking for essential processes or tutorial involved in building a asp.net mvc (C#) application that uses an Oracle database, including:
How to create Oracle Database connection strings
How to work with Connection, Command, and DataReader objects
I am looking for essential processes or tutorial involved in building a asp.net mvc (C#) application that uses an Oracle database, including:
How to create Oracle Database connection strings
How to work with Connection, Command, and DataReader objects
Pawan, do you just post anything that comes up in Google results?
Why post a link that states it is obsolete? It is also for a DataAdapter which isn't even part of the question.
Tay,
The first part is deciding what data provider you will use. If you were running a supported Oracle version, I would suggest the ODP.Net Managed Driver. It doesn't require an Oracle Client install and works with just about all Oracle data types and objects.
The problem you will have is finding a driver that will connect to a 9i database. ODBC might work but it is very limited in what it can do.
Once you find a data provider, then you can go looking for connection string examples. How you connect depends on the driver.
Why post a link that states it is obsolete? It is also for a DataAdapter which isn't even part of the question.
Tay,
The first part is deciding what data provider you will use. If you were running a supported Oracle version, I would suggest the ODP.Net Managed Driver. It doesn't require an Oracle Client install and works with just about all Oracle data types and objects.
The problem you will have is finding a driver that will connect to a 9i database. ODBC might work but it is very limited in what it can do.
Once you find a data provider, then you can go looking for connection string examples. How you connect depends on the driver.
ASKER
I installed .net developer with ODAC 11.2 Rel 4. but i want to learn how to create an Oracle db connection strings and how to work with Connection, Command, DataReader objects so i can write a sql script and display it in a data grid.
There are examples everywhere on the Internet. What are you after here that isn't already available?
Depending on which ODAC there is a sample folder that has working examples of most of the common things you will need.
Oracle also provides the ODP.Net samples here:
http://www.oracle.com/technetwork/indexes/samplecode/dotnet-sample-522126.html
The problem you are going to have is that I'm almost 100% sure that the 11g drivers will not connect to a 9i database.
YOu can try the OleDB and/or ODBC drivers but I'm pretty sure they won't connect either.
Datagrids are also pretty much dead. The Gridview has been around since .Net 2.0.
https://msdn.microsoft.com/en-us/library/05yye6k9(v=vs.100).aspx
Depending on which ODAC there is a sample folder that has working examples of most of the common things you will need.
Oracle also provides the ODP.Net samples here:
http://www.oracle.com/technetwork/indexes/samplecode/dotnet-sample-522126.html
The problem you are going to have is that I'm almost 100% sure that the 11g drivers will not connect to a 9i database.
YOu can try the OleDB and/or ODBC drivers but I'm pretty sure they won't connect either.
Datagrids are also pretty much dead. The Gridview has been around since .Net 2.0.
https://msdn.microsoft.com/en-us/library/05yye6k9(v=vs.100).aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
>>I am currently using ASP.Net MVC5 and Oracle.
>>Install the Oracle Managed Data Access from NuGet,
And you can connect to a 9i database?
>>Install the Oracle Managed Data Access from NuGet,
And you can connect to a 9i database?
slightwv, I am not sure because we don't have a 9i instance, only 10g.
Steps will like below-
1. Set Connection String. You can define this in code or may be in the configuration file. Configuration file will be better.
2. Open the connection using connection object.
3. Get the command you want to execute using command object.
4. Execute the command using datareader.
Sample example from microsoft is given at - https://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracledataadapter(v=vs.110).aspx
Hope it helps!
/ Pawan