开发者

MVC2 with mySQL and LINQ to SQL

I'm following an example out of my MVC2 book (ASP.NET MVC 2 Framework). My question is regarding LINQ to SQL and a mySQL database. The books examples connects to SQLServer, I am connecting to a mySQL database.

So far I have been able to connect to the DB and pull records... However, I'm noticing that I'm erroring on the following LINQ statement:

        return View(productsRepository.Products
            .Skip((page - 1) * PageSize)
            .Take(PageSize)
            .ToList()
            );

I've read that LINQ to SQL didn't originally support mySQL, however, with the mySQL .Net connector did that开发者_运维百科 change? Is LINQ to SQL fully supported for mySQL now?

Are there any references that would help me understand the differences if mySQL is still not supported fully?

Thanks

BTW the error message I'm getting is:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(ORDER BY t0.ProductId, t0.Name, t0.Description, t0.Price, t0.' at line 3


LINQ to SQL only supports SQL Server.

If MySQL support is required you should try using another ORM, such as Entity Framework or NHibernate.

In regards to the error thrown when trying to execute the query above, it is due to the fact that the SQL syntax used by SQL Server for paging is dramatically different to what is used by other relational databases.


Checkout DbLinq

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜