Oracle connectivity through asp.net
i want a complete connection string of how to add oracle database to the website in asp.net...
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jun 25, 2013, 8:59 PM EDT
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();
}
}