This is the solution below
I finally got it working all...here is the simple solutions. First and foremorst, make sure you are using the right various of sql*plus because I noticed for visual studio 2010 express, it is only compatible with Oracle Database Express Edition 11g Release 2, don't know why but I tired oracle 10g and that didnt work. Oracle Database Express Edition 11g Release 2 can be found at the following link below.
http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
the next step is to download the right drivers to establish the connection which can found at the following link below
http://www.oracle.com/technetwork/developer-tools/visual-studio/downloads/index.html and the name of the driver is ODAC 11.2 Release 3 (11.2.0.2.1) with Oracle Developer Tools for Visual Studio. That is the right driver for oracle 11g for asp.net 4.0.
Once the driver has been downloaded, it is time to write a simple program. An example is shown below
protected void Button1_Click(object sender, EventArgs e)
{
DataTable emptable = new DataTable();
string oradb = "Data Source=(DESCRIPTION ="
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=olisa-VAIO)(PORT=1521)))"
+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)));"
+ "User Id = finance; Password=financecc;";
OracleConnection conn = new OracleConnection(oradb);
conn.Open();
string sql = "select ID, Create_date from t_mobile";
OracleCommand cmd = new OracleCommand(sql, conn);
cmd.CommandType = CommandType.Text;
emptable.Load(cmd.ExecuteReader());
GridView1.DataSource = emptable;
GridView1.DataBind();
conn.Close();
conn.Dispose();
}
notice that you will need the right oracle .dll to establish the connection, this can be done by adding a reference, in the reference section click on browser and navigate to the following directory to add the oracle.dataaccess.dll
. the …