Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > LINQ
LINQ Discuss Microsoft's LINQ (Language INtegrated Query) for .NET 3.0 and later.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the LINQ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 4th, 2010, 12:59 PM
Registered User
Join Date: Jun 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default AdventureWorks

Started using the LINQ book. I downloaded SQL Server 2008 Express.
I also downloaded AdventureWorks 2008R Database files. My problem is with the example beginning on page 9 of the book, it is referring to Database called AdventureWorks which I do not have. Then looking for Table DirectoryInformation.

I have several AdventureWorks databases that got downloaded but none are just plain AdventureWorks.

Am I supposed to be looking for some older version?
Old June 6th, 2010, 12:38 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik

hello there
I dont have the book so Im not sure about DS version but u may find it in MSDN or http://msftdbprodsamples.codeplex.com/
remember we have a new version of AdventureWorks in 2008 witch is a bit simple u can download ur AdventureWorks & go with samples

Hovik Melkomian.
Old June 14th, 2010, 07:56 AM
Registered User
Join Date: Jun 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Still having problems:

Okay, I need a little more help. Got the database solved the next day. Been working on something since. Still on the same page in book.

The code they use is as follows:
AdventureWorks db = new AdventureWorks("Integrated Security=sspi");

[Database(Name = "AdventureWorks")]

public class AdventureWorks : DataContext
//public Table<DirInfo> DirectoryInformation;
public AdventureWorks(string connection) : base(connection) { }
public Table<DirectoryInformation> DirectoryInformation;


[Table(Name = "DirectoryInformation")]
public class DirectoryInformation
public string DirectoryName;

[Column(DbType = "varchar(255)")]
public string DirectoryDescription;

They then read and use the records in the database.
My problem is this, where (how) are they telling it where the database resides?
The book continues on as if I have already done so. It cannot find the database and create an instance of it especially since it has no idea where it is.
They are not showing me any connection string or where to use it in their example.

Can anyone help me with this?
Thank you.
Old June 23rd, 2010, 08:07 AM
Registered User
Join Date: Jun 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Invalid Object Name

Okay, lets try something different.
Still on same page for 4 weeks now, no help here so far, try once more.
Connecting to database okay but get SqlException Invalid object name DirectoryInformation when trying to query the table.

Does anyone have any suggestions?
Old June 23rd, 2010, 09:46 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi there,

You can assign a connection string to the constructor of the DataContext. E.g. rather than specifying:

"Integrated Security=sspi"

you should be able to pass something like this instead:

Data Source=.\SqlExpress;Initial Catalog=AdventureWorks;Integrated Security=True;

which points to a local instance of SQL Server called SqlExpress which should already have the AdventureWorks database attached to it.

For info about attaching database, take a look here: http://imar.spaanjaars.com/395/confi...ql-server-2005


Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Links845 (June 24th, 2010)
Old June 24th, 2010, 07:35 AM
Registered User
Join Date: Jun 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts

Thank you very much Imar.
The link you sent was very helpful along with your code suggestion.
Gives me choices to play with and get more understanding.

Similar Threads
Thread Thread Starter Forum Replies Last Post
AdventureWorks Sample Database swmukesh BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 May 26th, 2010 02:27 PM
Problem deploying AdventureWorks SSAS database kuznickic SQL Server 2008 0 January 15th, 2010 04:11 AM
Adventureworks Termresults table?? chapter 6 cyberpine BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 1 February 9th, 2008 04:26 PM
SSIS Adventureworks TerrmResults Table?? cyberpine SQL Server 2005 0 February 9th, 2008 04:00 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.