Description of the Article
A Simple program to show connecting to an oracle database.
Source Code:
/********************************///Program Name : ADO Connection to Oracle//Description : A Sample program to connect to the oracle database//Created On : 01 May 2001//Created By : Ravi Shankar Venkatarajalu/********************************/using System;using System.Data;using System.Data.ADO;class OracleTest{static void Main(){//UID - User Id//PWD - Password//Server - Your Service name//Using Microsoft ODBC for Oracle DSN-Less//const string strConn = "Provider=MSDASQL;DRIVER={Microsoft ODBC for ORACLE};UID=scott;PWD=tiger;Server=fnqa";//Using Microsoft OLEDB Provider for Oracleconst string strConn = "Provider=MSDAORA.1;Data Source=oracle_db;User ID=scott;Password=tiger";//Using DSN Connection//const string strConn ="DSN=oracle_dsn;UID=scott;PWD=tiger" ;const string strSQL = "Select * From EMP";try{DataSet ds = new DataSet("EmployeesSet");ADODataSetCommand myCommand = new ADODataSetCommand(strSQL,strConn);myCommand.FillDataSet(ds,"Buyer");Console.WriteLine(ds.Xml);}catch(ADOException e){Console.WriteLine("Exception Occured :{0}",e.Errors[0].Message);}}}
Connect to an Oracle Database
SQLDataReader Vs. DataSet
using System.Data.ADO; this line in the above code is giving below error for me.Error 1 The type or namespace name 'ADO' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) C:\Documents and Settings\abhilash\My Documents\Visual Studio 2008\Projects\DBConnect\DBConnect\Program.cs 3 19 DBConnect
I m unable to connect oracle database with C#.net. "MSDORA provider is not install in your local machine". i hv to install oracle client version on my local machine? Or i can directly connect. Provider name, Connection string format?
this works with ORACLE EXPRESS 10g? also data source would mean the name of the database,is this correct?
i want to conect to remote oracle database from my c# application using Oracleclient , not ADO. how can i do that. i have tried using folowing connection string data source='@192.168.0.37/xe; uid=uid;password=pass;but experience the following error;ORA-12154: TNS:could not resolve service nameplz help me.