Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > Visual Web Developer 2005
|
Visual Web Developer 2005 Discuss creating ASP.NET 2.0 sites with Microsoft's Visual Web Developer 2005. If your question is more specific to a piece of code than the Visual tool, see the ASP.NEt 2.0 forums instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2005 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 January 2nd, 2010, 04:41 AM
Authorized User
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 72
Thanks: 17
Thanked 0 Times in 0 Posts
Question Invalid value for key 'attachdbfilename'

Hi,

I am using asp.net 2.0, SQL 2005 Express Edition.

I have created one database, thats working fine on local host.

But when I transfered files to my hosting server, Then its giving me Error:-
Invalid value for key 'attachdbfilename'.

My connection string is as follows:-

data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|Data TestingServer.mdf;Database=DataTestingServer;User Instance=true


Please Help me.

Anup
 
Old January 2nd, 2010, 12:34 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Quote:
Originally Posted by anup.maverick View Post
But when I transfered files to my hosting server, Then its giving me Error:-
Invalid value for key 'attachdbfilename'.

My connection string is as follows:-

data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|Data TestingServer.mdf;Database=DataTestingServer;User Instance=true
The error would indicate that it's having trouble with the database. Can you confirm that the DataTestingServer.mdf file is in the correct location on your hosting server. That's the only thing that comes to mind, since your code says...

Code:
AttachDBFilename=|DataDirectory|DataTestingServer.mdf;
then I believe the database should be in the App_Data folder.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old January 4th, 2010, 01:20 AM
Authorized User
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 72
Thanks: 17
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by chroniclemaster1 View Post
The error would indicate that it's having trouble with the database. Can you confirm that the DataTestingServer.mdf file is in the correct location on your hosting server. That's the only thing that comes to mind, since your code says...

Code:
AttachDBFilename=|DataDirectory|DataTestingServer.mdf;
then I believe the database should be in the App_Data folder.
Yes , I have kept my database in App_Data Folder,

And when I remove AttachDBFilename property & replace it with Initial Catalog="MYDatabaseName", then it gives me another Error as follows :-

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Thanx
Anup
 
Old January 4th, 2010, 03:25 AM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

If it's a connection string issue, I sure don't see it.

The only other idea I can think of is contacting your web host to make sure they've turned on your access to SQL Server. I got similar error messages when I tried it on my account which turned out not to support SQL Server. Even if your account does, it may be something that your host has to activate before it will work. But that's the only other thing I can think of.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
The Following User Says Thank You to chroniclemaster1 For This Useful Post:
anup.maverick (January 5th, 2010)
 
Old January 4th, 2010, 03:46 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Take a look at this:

AttachDBFilename=|DataDirectory|Data TestingServer.mdf;Database=DataTestingServer

You're specifying AttachDBFilename *and* a Database name. Try limiting it to:

AttachDBFilename=|DataDirectory|Data TestingServer.mdf;

only....


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!
 
Old January 4th, 2010, 04:09 AM
Authorized User
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 72
Thanks: 17
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
Take a look at this:

AttachDBFilename=|DataDirectory|Data TestingServer.mdf;Database=DataTestingServer

You're specifying AttachDBFilename *and* a Database name. Try limiting it to:

AttachDBFilename=|DataDirectory|Data TestingServer.mdf;

only....


Imar

I done this, Its not working..!!
Its giving me Error as Follows
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

How can I solve this Error.??

Thanx
Anup
 
Old January 4th, 2010, 04:29 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

That sounds like a) you don't have a local SQL Server called SqlExpress or b) it's not configured to allow connections.

Can you confirm you have SQL Server installed (look under Services in Administrative Tools and search for an instance called SQLExpress).

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!
 
Old January 4th, 2010, 04:34 AM
Authorized User
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 72
Thanks: 17
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
That sounds like a) you don't have a local SQL Server called SqlExpress or b) it's not configured to allow connections.

Can you confirm you have SQL Server installed (look under Services in Administrative Tools and search for an instance called SQLExpress).

Cheers,

Imar
On My Local System, Its working all fine(There is no Error locally).

But when i copied my files to Hosting server, there the Error comes.

What's the solution?

Thanx
Anup
 
Old January 4th, 2010, 04:47 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In that case, look at what chroniclemaster1 said:
Quote:
it may be something that your host has to activate before it will work.
You'll need to talk to your host and ask them what kind of connection string you need to use. Typically, hosts don't use SQL Express and require you to connect to another instance of SQL Server.

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:
anup.maverick (January 5th, 2010)
 
Old January 4th, 2010, 05:05 AM
Authorized User
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 72
Thanks: 17
Thanked 0 Times in 0 Posts
Default

I will do so..


Thanx for all ur help.
-Anup





Similar Threads
Thread Thread Starter Forum Replies Last Post
Foreign key not updating with Primary key xavier1945 BOOK: Access 2003 VBA Programmer's Reference 2 July 4th, 2007 09:48 PM
Using key() and <xsl:key> freddy XSLT 2 January 18th, 2007 08:55 PM
<bean:message key="PNR.INPUT"/> key has null value warsha_14 Struts 1 November 13th, 2006 07:26 AM
TAB KEY working together KEY PRESS event thomaz C# 4 August 20th, 2006 02:47 PM
FOREIGN KEY and PRIMARY KEY Constraints junemo Oracle 10 June 15th, 2004 01:00 AM





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