Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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 May 21st, 2008, 05:55 PM
Registered User
 
Join Date: May 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change Database Name for BugBase

Hi,

I am enjoying reading the instant results book, and will use the book as a handy-reference for my projects.

Is there a way to change the name of BugBase database (BugBase.mdf) used in Ch. 12 of the book?

I changed the name of the .mdf file in the Solution Explorer and also reflected the change in the web.config file. However, the application doesn't look working correctly.

At the end, I somehow ended up with two mdf files in the App_data folder: one with the new name, and the other with BugBase.mdf.

Can please somebody guide me to go through this?

Thank you.




 
Old May 22nd, 2008, 05:40 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you define "doesn't look working correctly."?

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old May 22nd, 2008, 10:23 AM
Registered User
 
Join Date: May 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm getting this error when I click 'Application' under 'Maintenance'.

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

Could not find stored procedure 'sprocApplicationSelectList'.
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: Could not find stored procedure 'sprocApplicationSelectList'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Could not find stored procedure 'sprocApplicationSelectList'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlExc eption exception, Boolean breakConnection) +925466
   System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +800118
   System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +186
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
   System.Data.SqlClient.SqlDataReader.ConsumeMetaDat a() +31
   System.Data.SqlClient.SqlDataReader.get_MetaData() +62
   System.Data.SqlClient.SqlCommand.FinishExecuteRead er(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
   System.Data.SqlClient.SqlCommand.RunExecuteReaderT ds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1005
   System.Data.SqlClient.SqlCommand.RunExecuteReader( CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
   System.Data.SqlClient.SqlCommand.RunExecuteReader( CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior behavior, String method) +122
   System.Data.SqlClient.SqlCommand.ExecuteDbDataRead er(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.System.Data.IDbComman d.ExecuteReader(CommandBehavior behavior) +7
   System.Data.Common.DbDataAdapter.FillInternal(Data Set dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +141
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
   System.Web.UI.WebControls.SqlDataSourceView.Execut eSelect(DataSourceSelectArguments arguments) +1770
   System.Web.UI.DataSourceView.Select(DataSourceSele ctArguments arguments, DataSourceViewSelectCallback callback) +17
   System.Web.UI.WebControls.DataBoundControl.Perform Select() +149
   System.Web.UI.WebControls.BaseDataBoundControl.Dat aBind() +70
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.Ens ureDataBound() +82
   System.Web.UI.WebControls.CompositeDataBoundContro l.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +50
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433


*********
*********
As I described in the initial posting, I am now having 2 databases: the re-named one and the BugBase. When I looked at the stored procedures under each database, only BugBase has the missing stored procedures.

Again, my goal is to end up with one database whose name is NOT BugBase, but with ASP.NET memebership features and BugBase objects with it.

Thanks.




 
Old May 22nd, 2008, 10:38 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:When I looked at the stored procedures under each database, only BugBase has the missing stored procedures.
That seems to indicate the web app picked up the right database, but it's not a valid copy somehow?

Renaming doesn't seem enough. Internally the database keeps track of the name as well. You can rename the files as follows:

1. Open the database using Microsoft SQL Server Management Studio

2. Open its Properties

3. Switch to the Files category

4. Change the Logical name to your new name.

Following this procedure I could make it work.

Alternatively, script the objects in the existing BugBase database and recreate them in the new one:

http://Imar.Spaanjaars.Com/Downloads...erver_2005.zip

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old May 22nd, 2008, 11:50 AM
Registered User
 
Join Date: May 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,
thanks much for the INSTANT reply and detailed instruction.

I will follow the steps you described and let you know what I will experience.

Have a good one.


 
Old May 22nd, 2008, 02:25 PM
Registered User
 
Join Date: May 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,
I took both approaches you described.

Using the first approach (changing the logical name), it worked. However, the physical name of the database (BugBase.mdf) stayed the same although the logical name changed. Is there a way to change both physical and logical names? I apologize for my lack of knowledge in SQL Server...

Regarding the alternative approach, I created a new database, and ran the sql script you provided. Then, I applied the asp.net membership-related Schema to the new database (I used the steps in http://aspnet.4guysfromrolla.com/articles/040506-1.aspx). Then, after modifying the web.config, I was able to run the BugBase application using the new database.

Thank you very much for guiding me through this. I was inspired by your chapters on the book as well as by the excellent articles on the n-tier design on your web site. I will use your design model and coding tips for my current and future projects.

Regards,



 
Old May 22nd, 2008, 03:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You're welcome; glad things are working now and good to hear you like my work.

The physical file can be renamed using Windows Explorer or the Solution Explorer like you tried earlier. The physical name is just the Windows file name (BugBase.mdf) while the logical name is SQL Server's way of keeping track of databases that consist of multiple files.

You need to rename both in order to rename the database. Or, as you found out, just create a brand new database.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old May 23rd, 2008, 10:19 AM
Registered User
 
Join Date: May 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much for the follow-up and additional information.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Change database connection song Visual Basic 2005 Basics 4 November 30th, 2007 01:22 AM
change database location on CR 10 at run time blu3_x30n Pro VB 6 0 March 30th, 2006 01:25 PM
Crystal Report-Database change Agus999 BOOK: Professional Crystal Reports for VS.NET 2 December 30th, 2004 08:23 PM
How to change server and database name in CR.NET pajer Crystal Reports 4 October 27th, 2004 09:02 PM
CR8 - change location of database file / tablename meenakshikalera Crystal Reports 0 June 23rd, 2004 11:12 AM





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