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|DataTestingServer.mdf;Database=DataTestingServer;User Instance=true

Please Help me.


you can write right click the database(mdf) file in the database(server) explorer and click properties..on the right side, you can view the properties window,Which you can get the connection string....
Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Jacob Varghese\My Documents\Visual Studio 2005\WebSites\sample\App_Data\Database.mdf;Integrated Security=True;User Instance=True
you copy all that and use

string connectionstring="Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True";

if you got it correct,please mark it as solved.

if you got it correct,please mark it as solved.

even i was having the same prob,,, it helped me in solving thanks bro :))))