0

I'm trying to create an MVC site that connects to a third-party Oracle DB for which I only have read access. This is my first time using MVC and Razor, so I created an ASPX page in the root folder to help with debugging and verifying my data.

Right now I'm just trying to display data from a query in one of my views. I used this example as a guide for connecting to the DB in the model. In my debug ASPX page, I created a GridView with the SqlDataSource set to the same connection string and query.

The GridView displays the data without any issue, but when I try to go to the View, I get the following error when it reaches the connection's Open command:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

What is different about the way the GridView's SqlDataSource is connecting to the DB, and how can I replicate that over in my model?

1
  • There's really not enough information here to give a definitive answer. Are the GridView and the View using the same connection string,for example? Commented Oct 25, 2011 at 21:58

1 Answer 1

2

If you're connecting to Oracle, you don't want to use SqlConnection, you need to use the oracle versions of these.

http://msdn.microsoft.com/en-us/library/ms973871.aspx

Sign up to request clarification or add additional context in comments.

Comments

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.