about 2 years ago - 25 comments
When learning LINQ-to-SQL, it’s not immediately obvious how to do an update. Querying is easy, and there are methods for inserting and deleting. Updating usually occurs by modifying an object already known to the DataContext and then calling SubmitChanges on the context.
var product = (from p in dataContext.Products
[...]
about 2 years ago - No comments
Quick tip: If you want to see the SQL generated by LINQ to SQL for a query or command, simply set the Log property of your generated DataContext class to an instance of a TextReader.
If this is your code:
using System;
using System.Linq;
using System.Data.Linq;
namespace LINQtoSQLConsole {
class Program {
static void Main(string[] args) [...]
about 2 years ago - 9 comments
When you started using LINQ, did you think it looked like SQL? I did.
The more I learned LINQ, the more I realized it wasn’t anything like SQL. Take grouping, for example. Because LINQ has a group by statement, and it looks like SQL, I assumed that the syntax for grouping in LINQ would be just [...]
about 2 years ago - 3 comments
Last week I had to prepare a small presentation for a new LINQ workshop. For my research, I browsed through the MSDN documentation on LINQ where I came across a reference to "LINQ to DataSets". I couldn’t find any more information about it though, and so LINQ to DataSets got a small mention in my [...]
about 2 years ago - No comments
Dude! I got quoted! And by none other than Rob Conery of SubSonic fame.
It seems like my last post caused quite an unexpected stir. Thanks to both Rob and Scott for taking the time to answer me. I really appreciate it.
A Word of Appreciation
Let’s get something in perspective. Rob has actually produced something of immense [...]
about 2 years ago - 5 comments
I am really getting into LINQ now! I think it’s fantastic. I recently wanted to develop a quick drop-down list in ASP.Net which allows a user to select a time of day from a list. The times are 15 minutes apart, so the list would look like this:
… 08:00 08:15 08:30 08:45 09:00 …
… and [...]