Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 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 Display Modes
  #1 (permalink)  
Old August 31st, 2006, 03:28 PM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error with CH. 10 ObjectDataSource Control in C#

I've seen two posts already on this error, but no responses on how to correct the problem

Once I have completed the "Try it out" section (adding a ObjectDataSource and GridView), I open my browser to the default page and receive this error:

Server Error in '/Wrox' Application.
--------------------------------------------------------------------------------

CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\BegASPNET2\Begin\Chapter10\ObjectDataSource\App _Data\WroxUnited.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\BegASPNET2\Begin\Chapter10\ObjectDataSource\App _Data\WroxUnited.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Source Error:


Line 783: this.Adapter.SelectCommand = this.CommandCollection[0];
Line 784: osd.PlayersDataTable dataTable = new osd.PlayersDataTable();
Line 785: this.Adapter.Fill(dataTable);
Line 786: return dataTable;
Line 787: }


Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\wrox\6595bd89\1c926d70\App_Code.yawm7sb0.0.c s Line: 785

I'm using SQL Server 2005 Express. Does anyone know how I can fix this error?

  #2 (permalink)  
Old August 31st, 2006, 06:22 PM
Authorized User
 
Join Date: Jan 2006
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I didn't have a problem with that particular Try It Out, but I got that same "An attempt to attach an auto-named database..." error message in the Try It Out that starts on page 375. The reason for the error was that the path to the database in the connection string inside Web.Config was incorrect.

So one thing to do is make sure there's actually a database in C:\BegASPNET2\Begin\Chapter10\ObjectDataSource\App _Data\.
  #3 (permalink)  
Old September 1st, 2006, 12:48 PM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The path is correct. I saw your post about the path in webconfig, but there is a database located at that path. I am somewhat curious about the line in the error that reads "CREATE DATABASE permission denied in database 'master'". Is there some type of permission that needs to be added to SQL server express? Any help anyone can give me will be greatly appreciated.

  #4 (permalink)  
Old October 7th, 2006, 04:55 PM
Registered User
 
Join Date: Oct 2006
Location: San Francisco, CA, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had this problem running in Vista, so I suspect it's caused by the permission given to the local user when running Cassini, when I tried running the exercises in IIS, I received no error.
  #5 (permalink)  
Old October 13th, 2006, 10:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Banbury, , United Kingdom.
Posts: 105
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to DanM
Default

dramsey,

I think that the simplest way to sort this out is to add another step prior to Step 2 of the try it out on page 359 and that's to open web.config and delete the connection strings defined there already. Then in step 6, create a new connection to the wroxunited.mdf file in the ObjectDataSource\app_Data folder of your project.
That should solve it.

FWIW, I think the connection string in web.config there in the download is mispelt. It says AttachDbFilename=|DataDirectory|WroxUnited.mdf rather than AttachDbFilename=|DataDirectory|\WroxUnited.mdf

Dan


Dan Maharry
Read the feed at http://feeds.feedburner.com/dansarchive
  #6 (permalink)  
Old January 15th, 2007, 02:52 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mr. Dramsey,
 I'm still looking for the answer of the problem faced by you. Have it been solved ? If so , please guide me .

I'm confused as http://forums.microsoft.com/MSDN/Sho...37473&SiteID=1 link says something which is hard to be understood by me.

Pl. guide/Help.

Thanks

  #7 (permalink)  
Old January 15th, 2007, 03:01 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

By the way , all of you are requested to Help guide me on the following problem ;

Up on selecting web site -> web site configuration OR trying to run the application CASSini I'm getting the error as " Unable to load the current version of the run time to run this application" . Then after I'm getting the error as " Unable to contact Visual Studio's Localhost server".
This is forced me to use another web server other than Cassini.
Pl. help/guide

  #8 (permalink)  
Old February 14th, 2007, 11:09 PM
Registered User
 
Join Date: Feb 2007
Location: , Michigan, .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I ran into the same issue as I was going through the examples in Chapter 10. I found the answer in the following link:

http://forums.asp.net/thread/903667.aspx

Within the web.config file, I changed the connectionstring to the following:

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\WroxUnited.mdf;Integrated Security=True;User Instance=True"

The page will now render in debug mode without errors. Hope this helps.

MIKE

 


Thread Tools
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
C# Ch 10 Page 362 surefire BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 5 February 25th, 2008 01:55 PM
C# Ch 10 Page 370 - Simple User Control surefire BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 4 February 25th, 2008 01:53 PM
ObjectDataSource control ewhizz ASP.NET 2.0 Basics 1 August 15th, 2006 01:09 PM
Get Information about ObjectDataSource control deokule2003 Visual Studio 2005 0 March 7th, 2006 07:26 AM



All times are GMT -4. The time now is 06:46 AM.


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