1

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 ?

2 Answers 2

0

In Visual Studio 2010, references are not always included in the solution package by default. So just because it is in the project references, does not necessarily mean it will make the trip to the server. To check if your DLL is in the solution package:

  • open Package from the Solution Explorer
  • click the Manifest tab

Do the following steps, if your DLL is not listed in the Assemblies section:

  • click the Advanced tab
  • under Additional Assemblies, click Add > Add Existing Assembly...
  • locate your DLL and click OK
Sign up to request clarification or add additional context in comments.

1 Comment

Hey Rich,Thanks dll was not there and I've added it as you said. Still the same error.
0

Do you have Oracle.DataAccess.dll . You need to put it in bin directory of sharepoint web application.

Alternatively, you must be referring it in your web part as a reference. Make sure that this DLL is included in your solution package.

1 Comment

Thanks Madhur.I've referenced Oracle.dataaccess.dll to my SharePoint project. Along with that I've copied the dll in BIN folder , \web server extensions\14\BIN and \web server extensions\14\config\BIN Still no success.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.