help with oracle and c sharp?

andalib

New member
hello im trying to connect oracle with my lil c charp written app but i duno how to connect...i hav a code that looks like this:
using System;
using System.Data;
using System.Configuration;
//using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data.OracleClient;


namespace WindowsApplication1
{
class OracleDataAccess
{

public OracleDataAccess()
{
//
// TODO: Add constructor logic here
//
}
static string _ConnectionString = @"Data Source=orcl;Persist Security Info=True;User ID=system;password=asdf;Unicode=True";

static OracleConnection _Connection = null;

public static OracleConnection Connection
{
get
{
if (_Connection == null)
{
_Connection = new OracleConnection(_ConnectionString);
_Connection.Open();

return _Connection;
}
else if (_Connection.State != System.Data.ConnectionState.Open)
{
_Connection.Open();

return _Connection;
}
else
{
return _Connection;
}
}
}


public static DataSet GetDataSet(string sql)
{
OracleCommand cmd = new OracleCommand(sql, Connection);
OracleDataAdapter adp = new OracleDataAdapter(cmd);

DataSet ds = new DataSet();
adp.Fill(ds);
Connection.Close();

return ds;
}

public static DataTable GetDataTable(string sql)
{
DataSet ds = GetDataSet(sql);

if (ds.Tables.Count > 0)
return ds.Tables[0];
return null;
}

public static int ExecuteSQL(string sql)
{
OracleCommand cmd = new OracleCommand(sql, Connection);
return cmd.ExecuteNonQuery();
}
}

}

but this gives three errors as follows:
Error1The type or namespace name 'OracleClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)c:\documents and settings\andalib\my documents\visual studio 2010\Projects\HappyRideTravels\HappyRideTravels\Form1.cs1219HappyRideTravels
Error2The type or namespace name 'OracleConnection' could not be found (are you missing a using directive or an assembly reference?)c:\documents and settings\andalib\my documents\visual studio 2010\Projects\HappyRideTravels\HappyRideTravels\Form1.cs2716HappyRideTravels
Error3The type or namespace name 'OracleConnection' could not be found (are you missing a using directive or an assembly reference?)c:\documents and settings\andalib\my documents\visual studio 2010\Projects\HappyRideTravels\HappyRideTravels\Form1.cs2923HappyRideTravels

now how do i fix these and how wud i manage to connect to the database finallY?? and what do need to write in the constructor logic?? plz help
 
Back
Top