SharePoint Visual web part and Oracle connection problem
- by Rishi
Hi,
I'm trying to build a "visual web part" for SharePoint 2010 which should connect to Oracle table and display records on SharePoint page.For development, Oracle 11g client (with ODP.net) ,SharePoint server 2010, Visual Studio 2010 and Oracle 10g express all running on my machine.
First,I've written sample code in ASP.NET web app to connect my local Oracle table and display data in grid view and it works fine. My code is ,
OracleConnection con;
try
{
// Connect
string constr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)));User Id=SYSTEM; Password=password";
con = new OracleConnection(constr);
//Open database connection
con.Open();
// Execute a SQL SELECT
OracleCommand cmd = new OracleCommand("select * from T_ACTIONPOINTS WHERE AP_STATUS='Active' ", con);
OracleDataReader dr = cmd.ExecuteReader();
GridView.DataSource = dr;
GridView.DataBind();
GridView.AllowPaging = true;
}
catch (Exception e)
{
lblError.Text = e.Message;
}
Now, I'm trying to create new "SharePoint" visual web part project and using same code and deploying it on my local SP server. But when it runs , I get following error
here is my solution explorer,
It looks something wrong in compatibility.Can someone point me in right direction ?