views:

320

answers:

3

hi

I want to use MYSQL database for accesssing the data in a mvc application.

The connection string that i am using in web.config is:

Then I have prepared a model,controller,view for accessing and displaying the data.

I am using LINQ o get the data from database but getting the exception:" 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)"

I have also installed the MYSQL connector.

Please provide me the solution to access the data using MYSQL and LINQ in MVC application

Thanks in advance.

A: 

You can't use LINQ to SQL. You should use entity framework. Linq to SQL is only for MS Sql. Use EF to work with any other DB, and then you can use LINQ to EF.

Linq to SQL is obsolete http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx

nemke
Actually, there are LINQ-To-***** Providers for other databases too, lots of third party options out there: http://www.devart.com/dotconnect/ We're using their oracle linq-to-sql provider, works great
Nick Craver
Hmm, interesting, but how good are they? Did you have any issues?
nemke
@nemke: We've run into a few, but the support is astounding, usually a few hours for a reply, a week or two for a build with a fix if it's a bug on their end. I can't speak as to other providers, we've one used devart, but at I think $550 or so for 4 developers, no server licensing involved...easily worth the money
Nick Craver
Ok, but if he want out of the box, free solution EF is the way to go. If he has additional money to spend then sky is the limit for any experiments.
nemke
A: 

Deleting my previous answer...I read your question as LINQPad, no idea why.

To be short, get a third party provider, I can't speak for others, but devart's dotConnect for Oracle has worked very well for us: Here's their MySQL version.

Nick Craver
A: 

You could use NHibernate and Linq-to-Nhibernate and then you are not database tied.

NHibernate Files http://sourceforge.net/projects/nhibernate/files/

But this I guess is dependent on how much time you have to develop!

Aim Kai