SharePoint Visual web part and Oracle connection problem

Posted by Rishi on Stack Overflow See other posts from Stack Overflow or by Rishi
Published on 2011-02-01T08:58:57Z Indexed on 2011/02/01 15:25 UTC
Read the original article Hit count: 377

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

enter image description here

here is my solution explorer,

enter image description here

It looks something wrong in compatibility.Can someone point me in right direction ?

© Stack Overflow or respective owner

Related posts about visual-studio-2010

Related posts about sharepoint2010