Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 May 25th, 2007, 05:17 AM
Authorized User
 
Join Date: May 2007
Location: Oslo, , Norway.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASPNETDB.MDF Changing

Hei,

After having problems with import/export because of SSIS not in MS SQL Express, I had to uninstall all the MS SQL Express database, and replace it with the new MS SQL 2005 Standard.

Everything when well for the import/export. The problem is that my ASPNETDB.MDF settings in Visual Studio 2005 is changing the connection source all the time to the old EXPRESS.

What I did is :
1- right click the database ASPNETDB.MDF.
2- modify connection
3- change data source to "Microsoft SQL Server (SqlClient)"
4- check the box "always use this section"

Everytimes I close Visual Studio, then the data source change back to "Microsoft SQL Server database file" which correspond to the old EXPRESS. Therfore I have to re-configure it to MSSQLServer again.

What is going on, and how to fix this unvoluntary change?

Thanks


  #2 (permalink)  
Old May 25th, 2007, 10:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you change web.config? That's got the normal connection string.

  #3 (permalink)  
Old May 25th, 2007, 01:52 PM
Authorized User
 
Join Date: May 2007
Location: Oslo, , Norway.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I have modified my web.config like this:

<connectionStrings>

  <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=motemape;Initial Catalog=AgroDatabase;Integrated Security=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf" providerName="System.Data.SqlClient"/>

</connectionStrings>

AgroDatabase: is my database name.
motemape: is my Server name.
aspnetdb.mdf: is the database file located in App_Data folder

After modifying the connection, I get this name on Visual Studio:

motemape.AgroDatabase.dbo.

But after closing and restarting Visual Studio, it's get back to:

ASPNETDB.MDF "With Microsoft SQL Server database file"

instead of keeping the "Microsoft SQL Server (SqlClient).

  #4 (permalink)  
Old May 27th, 2007, 06:14 AM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

click on start ---> programs ---> Microsoft Visual Studio 2005 ---> Visual Studio tools ---> Visual Studio 2005 Command Prompt then type this command :
sqlcmd -E -S .\YourSQLServerName
Once you are in the sqlcmd program, you run the following command to attach the database:
sp_attach_db "DatabaseName", "full path to your mdf file"
go

example:

sp_attach_db "aspnetdb", "c:\Websites\TheBeerHouse\App_Data\AspNetDB.md f"
go

when your database is attached reconfigure visual studio 2005 again from server explorer.

cheers







 


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
Question about ASPNETDB.MDF frankym BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 October 3rd, 2008 11:26 AM
Get password value from aspnetdb.mdf rsearing ASP.NET 2.0 Basics 8 October 12th, 2007 09:12 AM
Combining aspnetdb.mdf and another DB rsearing ASP.NET 2.0 Basics 1 February 8th, 2007 11:44 AM
aspnetdb.mdf Jackxxx ASP.NET 2.0 Basics 0 January 9th, 2007 01:37 PM



All times are GMT -4. The time now is 03:52 PM.


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