Browse Folders

LINQ in Action Source Code

File Details
Downloads: 43350 File Size: 4.6MB
Posted By: Fabrice Marguerie Views: 82127
Date Added: Mon, Dec 10 2007
Complete source code for the LINQ in Action book, in both C# and VB.


Iwan said:

Linq mempermudah developer dalam pengembangan sostware.terima kasih
Thu, Jan 31 2008 0:01

Giocanni said:

Is the code runnable also? or is just a serie of code examples? for ex in the chapter 6-8 it tells me that I can't run a class application
Sat, Mar 08 2008 4:46

Fabrice Marguerie said:

Everything should compile and run fine. I double-checked, and everything runs fine for me. Did you set the Chapter06to08 project as the startup project? Maybe that this is not the default startup project. It could be that a class library project (Common or ObjectDumper) is selected as the startup project by default.
Sat, Mar 08 2008 6:05

Giocanni said:

Yes, everything works now! It wasn't the default startup project like you said... thx
Sat, Mar 08 2008 7:11

Se3ker385 said:

Thanks! :D
Mon, Mar 10 2008 12:32

Bogg said:

I wonder how can I find the dll reference for ObjectDumper Class shown in this Book's examples.
Tue, Mar 11 2008 0:42

Fabrice Marguerie said:

ObjectDumper is provided by Microsoft in the samples included with Visual Studio 2008. We also include the source code for this class in the download you can find on this page.
Tue, Mar 11 2008 11:27

csdk said:

Can I get an electronic copy of table 3.2? I want to present this to my team. THanks
Sat, Mar 29 2008 22:03

Fabrice Marguerie said:

csdk, see here :
Mon, Mar 31 2008 9:10

Rene said:

I am getting errors while trying to attach the “lia.mdf” and “nothwind.mdf” databases provided in the download to SQL Express 2008. Perhaps I am doing something wrong but if this error is expected because the databases are meant to work under sql server 2005 and not under 2008 then it would be nice if the download also included databases compatible with 2008 for those of us using this sql server version. Thank you.
Wed, Nov 26 2008 12:42

Fabrice Marguerie said:

Rene, The databases have been created with SQL Server 2005, but you should be able to attach them to SQL Express 2008. I'm not able to test this at the moment. I'll try tomorrow. What errors do you get? Fabrice
Wed, Nov 26 2008 13:22

Rene said:

Dang it, I knew I should have fully experimented with the issue regarding attaching the databases before posting. Anyway, the databases do attach to SQL server 2008 just fine. My problem was that I was copying the database files to the default folder where SQL 2008 stores the database files (C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA) and then trying to attach them from there and I was getting errors. Then I tried attaching the databases from a folder when I had full permissions and thing worked ok. Not sure why they database files won’t attach if they are located in the SQL server default folder but I bet it has something to do with permissions. The error message that you get just says that there was an error and to click at some nonexistent link for more information. I guess I shouldn’t be attaching the database files from the SQL server default database folders anyway because that is probably a bad practice but regardless off…. That was the cause of the problem. Sorry and thanks for the quick response.
Wed, Nov 26 2008 13:53

Fabrice Marguerie said:

Thank you for explaining what you were doing. It may help someone in the same situation. One more example of a useless SQL Server error message...
Wed, Nov 26 2008 14:10

bhaveshdave said:

I am not able to download the file. Please check it and repair it. thank you
Mon, Mar 16 2009 11:55

Fabrice Marguerie said:

What kind of error do you get? The download works fine here.
Mon, Mar 16 2009 12:07

Zishumba said:

What a good book. I am struggling using linq on an oracle database. I am using strongly typed datasets. How do u insert, update a strong typed dataset. Thanks
Tue, May 05 2009 3:20

Fabrice Marguerie said:

LINQ to DataSet is covered in chapter 14, which is available as a free PDF from However, inserting into and updating a DataSet is out of the scope of this book because this is basic .NET and it is not related to LINQ.
Tue, May 05 2009 3:49

Zishumba said:

Thanks. But i am not sure if i am right to say according to your answer i cant avoid using adapters for inserting and updating. ie calling adapter.Update(). Secondly, i was looking at your chapter 14 sample code FillDataSetUsingLinqToSql1(LinqBooksDataSet dataSet). Why doesnt the query return a datatable? Wouldnt it have been easy that way since your iterator variable automatically becomes a datarow. I tried with Northwind database. With the product table it gives an error on categoryID though i did it exactly the same way you did dataSet.Book.AddBookRow(book.ID, book.Title, book.Subject, dataSet.Publisher.FindByID(book.Publisher).... Any help.
Tue, May 05 2009 5:48

Fabrice Marguerie said:

Zishumba, please ask your questions in the book's forum. It will be easier to follow up, and everybody will be able to see your questions and help you. Please provide there code samples of what you're trying to do. Please, also include the details about the errors you get, otherwise we won't be able to help you. Thanks The forum is at
Tue, May 05 2009 6:37

Zola said:

can any one help to extract the source code as i can't extract the files it shows message box saying "Please insert the last dist of the Multi-Volume set and click ok to continue."
Wed, Jun 24 2009 9:02

Fabrice Marguerie said:

Zola, what are you using to extract the files? It works with WinZip and WinRar for me.
Wed, Jun 24 2009 9:42

Zola said:

I'm using WinZip
Thu, Jun 25 2009 0:41

WillC said:

Be sure to check out LINQPad f you have not yet done so. It is a great tool for playing with LINQ and beyond. The LINQ in Action samples can now be loaded directly in the LinqPad samples window. COOL!
Wed, Aug 12 2009 15:52

Murtaza Ali said:

Its good for begginer i will create mind to work with linq thanks
Mon, Aug 17 2009 2:26

cs said:

If I am using SQL Server 2005 instead of SQLEXPRESS, how would I change the app.config file? Thanks!
Tue, Feb 09 2010 11:08

CS said:

I attached the Northwind and lia to the localhost to create those two DB. Then added the connection string to App.config in chapter0608. In the program in place of these two lines: string path = System.IO.Path.GetFullPath(@"..\..\..\..\Data\northwnd.mdf"); DataContext db = new DataContext(path); I replaced with: string conn = "Data Source=YourMachineName/ServerName/Localhost;Initial Catalog=YourCatalogNamethatYouCreatedGoesHere;Integrated Security=True"; Voila! It worked! DataContext db = new DataContext(conn);
Tue, Feb 09 2010 11:55

Patrice Cote said:

I just can't compile it. Trying to run Chapter6To8, it says that it doesn't find C:\Program Files\Microsoft Visual StudioVC98\lib and C:\Program Files\Microsoft Visual StudioVC98\mfc\lib. I have no idea what this is.
Thu, Mar 25 2010 10:53

Fabrice Marguerie said:

Patrice, I've never heard about anything like this before. I guess it's a problem with your installation of Visual Studio. We don't use MFC or C++ in our samples.
Mon, Mar 29 2010 7:12

Li said:

Hi!I want to create a LINQ to SQL file in a project with the database file lia.mdf included in the source code of LINQ in Action, but I don't know the user name and password. I search them from the source code and I find nothing. I wonder if lia.mdf has user name and password? I use Visual Studio 2010.Thank you!
Sun, Jan 02 2011 7:33

Fabrice Marguerie said:

Li, there is no password in the database. I guess the password you need is the password for the SQL Server instance you are using.
Sun, Jan 02 2011 8:40

Li said:

Thank you! I have attached lia.mdf to my SQL Server, and it works well.
Sun, Jan 02 2011 23:03

Gonz@lo said:

Thank you! I really need this information. I'm from Argentina. thanks to all
Fri, Jan 14 2011 12:44

ljw said:

Thu, Jan 27 2011 21:49

kasif said:

Tue, Mar 22 2011 8:54

Irfan said:

Thank You...!
Thu, Jul 28 2011 2:04

David Glienna said:

Anyway to get VS2010 SLN files for the VB samples? From LP, the VB versions don't even execute, while the C# versions do. Trying to get either to run in VS2010 is not working. help@ David
Thu, Oct 13 2011 20:03

Tomas Walek said:

For those of you having permission problems with samples for chapters 6-8: 1) Attach the mdf file to your sql server 2) rename the attached DB so that it is called "linq" now 2) change both app.config and settings.cs connection strings to: Data Source=.\SQLEXPRESS;Initial Catalog=linq;Integrated Security=True;Connect Timeout=30 for SQL Express. When using different SQL instance, change the data source appropriately. Cheers, Tomas
Sun, Nov 13 2011 3:30

Gregg Mazel said:

Linq in Action troubles starting in the Microsoft SQL Server Management Studio Express "One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup. (.Net SqlClient Data Provider)" TO FIX I moved the ldf associated with the primary DB to another folder, then attached lia6-8.mdf which made a new lia6-8_log.LDF. then from within LinqPad I get: "Linqpad Cannot open user default database. Login failed." Need to change path? C:\USERS\JIM\APPDATA\ROAMING\LINQPAD\SAMPLES\LINQ IN ACTION\LIA6-8.MDF is incorrect... needs to be C:\USERS\USER\APPDATA\ROAMING\LINQPAD\SAMPLES\LINQ IN ACTION\LIA6-8.MDF OK Fixed it in the object explorer of Microsoft SQL Server Management Studio Express 9.00.4035.00 Microsoft Data Access Components (MDAC) 6.1.7601.17514 (win7sp1_rtm.101119-1850) Microsoft MSXML 3.0 4.0 5.0 6.0 Microsoft Internet Explorer 9.0.8112.16421 Microsoft .NET Framework 2.0.50727.5448 Operating System 6.1.7601
Tue, Dec 27 2011 8:27

Fabrice Marguerie said:

Gregg, thank you for sharing the solutions to the problems you encountered.
Tue, Dec 27 2011 10:27

Gajendra said:

nice content for Beginners.Thnx
Tue, Jul 24 2012 7:59

rain said:

Wed, Jul 03 2013 9:36

Yang said:

Hi, I downloaded the source code, but I couldn't open it in either vs 2008 or vs 2010. I always got error : "cannot be opened because its project type is not supported by this version of the application". Did I miss something here? Should I install something to make the sample code working? Many thanks
Thu, Sep 05 2013 6:27

Fabrice Marguerie said:

Yang, it seems that you are the first person with this issue. I don't know what can be the reason for this error.
Tue, Sep 10 2013 16:47

Yang said:

It seems ok now after I restart my computer several times. Thanks
Mon, Sep 16 2013 3:55

Bob said:

I get a 404 when trying to download the files.
Sun, Nov 24 2013 14:25

Fabrice Marguerie said:

Bob, I don't know why the file disappeared! I've put it back in place. Please try again.
Sun, Nov 24 2013 14:45

Add Comment

Name (required)
Web Site (optional)
Comment (required)