oracle connectivity through asp.net
i want a complete connection string of how to add oracle database to the website in asp.net...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sanjeeb LenkaPosted Jun 26, 2013, 12:59 AM
http://docs.oracle.com/cd/B28359_01/appdev.111/b28844/using_aspnt.htm
or you can follow these steps
1) Add reference of Oracle database client library.
2) Inside Web.Config File, Add connection string
connectionString="Data Source=
Now you are ready to make oracle connection
Add following function in your code file.
3) Function to read oracle connection string from web.config file.
private OracleConnection GetConnection(){
var conString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"];
string strConnString = conString.ConnectionString;
return new OracleConnection(strConnString);
}
4) Call GetConnection function to use oracle connection in your code.
//Sample code to open and close oracle connectionprotected void Page_Load(object sender, EventArgs e)
{
OracleConnection oConn = GetConnection();
if (oConn != null)
{
oConn.Open();
oConn.Close();
}
}