LINQ to SQL came out with 3.5 and I am still amazed that many people accomplished to stay away from that simple technology. When you ask them, they've heard about but they are not sure how everything works together. Instead of looking it up to learn to see if there is something that may improve their development, they just ignore it.
If you work in software, its your job to keep yourself on the loop for new technologies and languages coming out. Don't need to download everything from Codeplex and play with it, but you should include in your technical book reading a blog/news reading. Of course I keep broadcasting to everybody that hasn't turn me off by now, to subscribe to Community Blogs in ASP.NET and of course ScottGu's blog.
I've included in my interviews to ask a simple question, if you are applying for a ASP.NET job. Do you know who is Scoot Guthrie? You'll be amazed how many "ASP.NET developers" don't even know the name. Shocking!
Wanted to show you how to select something from a database and insert a row. For the exercise will use a simple table with a latitude, longitude and ID. If you have used previously dataAdapters aka DataSets in ASP.NET 2.0 you'll find LINQ to SQL familiar. Create a new Item and select LINQ to SQL, drag and drop all the tables you want.
Note: If you modify the table, the LINQ to SQL won't refresh, you'll have to delete and drag and drop again.
Select statement you'll find that LINQ provides you with from, where and select out of the box, so you can interrogate the table.
Select statement returning strong type. You'll find the => new in 3.5 for LINQ.
Insert a new row, make sure you got a primary key in each table you are trying to update. The syntax is familiar if you have been using DataSets/DataTable/DataRow
This is as simple as it goes to Select and Insert into a table using LINQ. I would recommend to run this very simple exercise for yourself. Grab an existing database, create a ASP.NET app and generate the LINQ to SQL for the database. Then try to select and insert using this simple example.
We learned by doing things and practicing. After that you'll need to figure it how to update in LINQ to SQL. I bet that after you do that, you'll start writing all your projects with a Database layer using LINQ to SQL.
Cheers
Al