I've been experimenting with Mango's new data libraries (System.Data.Linq) but I've never used Linq to SQL before and all of my existing code is written for SQLite with ADO.NET. Is there any way (via referencing a Silverlight DLL or otherwise, that I can just write the SQL myself or am I forced to use Linq if I want to use SQL Server CE?
Asked
Active
Viewed 362 times
1
1 Answers
3
The only way to use SQL Server CE on Windows Phone 7 is via Linq.
There is now way to use SQL that you write yourself.

Matt Lacey
- 65,560
- 11
- 91
- 143
-
1Nor is there any compelling reason to do so. Why would you deliberately forfeit static optimisation, strong typing and statement completion for no payoff whatsoever? – Peter Wone May 27 '11 at 14:07
-
4@Peter a reason to would be if you were using the same database on mulitple platforms. There would be a very compelling reason to not do it differently on different platforms if you didn't have to. – Matt Lacey May 27 '11 at 14:55
-
Exactly, I'm using this code on WPF and ASP.NET as well. Whereas I can switch SqlConnection for SQLiteConnection and SqlDataReader for SqLiteDataReader etc and easily keep all platform up to date, an ORM like Linq takes that away. I've decicded to go with the recent update to Community.CsharpSqlite instead. – Echilon May 28 '11 at 16:15
-
I take your point Matt, but since when was SQL the same on all platforms? Jet, MSSQL and Oracle all have differences, don't even get me started on string or date manipulation. You could stick with core ANSI SQL but if you insist on sameness what you will get is lameness. – Peter Wone Jun 04 '11 at 09:31
-
1@Peter on mobile platforms you are usually using a very small amount of the power that all the variants of SQL can give and only doing simple basic CRUD operations on simple data types. It is very common to use sqlite on mobile and this does work across platforms. The issues with trying to support Jet, ODBC, ADO.Net, Oracle, etc, that you get on variations of "desktop" or "server" hardware aren't as relevant on mobile. – Matt Lacey Jun 05 '11 at 15:31
-
As people realise what a marvellous tool they have, I think you might see wider application. For example, on the weekend I used LINQ to write a quadtree generator for some WP7 map work I'm doing. 21ms to organise 4000 points into a quadtree on a phone. More LINQ to select points thinned to suit zoom level. I do this every time the map is panned or zoomed. It takes 4ms. Notwithstanding any credit to me for a good algorithm, that's unbelievable performance from LINQ. – Peter Wone Jun 07 '11 at 03:33