OK, this is sure to be really silly stuff for some of you, but as I do 9x% of my work with SQL Server, taming the Oracle beast is a real challenge for me. The very first round, filling a dataset:
using (OracleConnection con = new OracleConnection("User Id=xyz;Password=zzzz;Data Source=orcl"))
OracleDataAdapter da = new OracleDataAdapter("select * from HR.EMPLOYEES", con);
catch (OracleException ex)
Here, ORCL is the Oracle instance (TNS) that I want to connect to and HR is the schema that I want to use. For this code to compile, we must make a reference to the Oracle.DataAccess assembly which lives (in the standar Oracle installation) in C:\oracle\product\10.1.0\Db_2\BIN. By the way, you need this folder in your PATH (yes, your PATH, that old Windows artifact) and read access to the folder (this is relevant to me, as I've been developing as a non-administrator since a few weeks ago, so far so good, I haven't become more productive but I feel better). This code also works as is if you use the Visual Studio 2003 Oracle Data Provider, all you have to do is change the using line and referencing the System.Data.OracleClient assembly. By the way, anybody out there has any suggestions as which data provider is better?