Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > LINQ
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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?
  #2 (permalink)  
Old June 6th, 2010, 12:38 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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

HTH
__________________
Always,
Hovik Melkomian.
  #3 (permalink)  
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
{
[Column(DbType="varchar(50)")]
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.
  #4 (permalink)  
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?
  #5 (permalink)  
Old June 23rd, 2010, 09:46 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,052
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

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

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
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)
  #6 (permalink)  
Old June 24th, 2010, 07:35 AM
Registered User
 
Join Date: Jun 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:21 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.