Last post Apr 18, 2013 09:14 PM by ultrafastneal
Jun 25, 2008 11:14 AM|prajapatiamit2003|LINK
My project my db in app_data folder db name is test.mdf
and my connection string is
<add name="realestate" connectionString="Data Source= ftpIP;Network Library=DBMSSOCN;user id=ftpuser;password=ftppassword; AttachDbFilename= |DataDirectory|Test.mdf; Integrated Security = false;" />
<add name="ConnectionString" connectionString="Data Source=ftpIP;Network Library=DBMSSOCN;user id=ftpuser;password=ftppassword;AttachDbFilename=|DataDirectory|Test.mdf;Integrated Security=False;"
when i run my application that give me error
Invalid value for key 'attachdbfilename'
Jun 25, 2008 11:22 AM|SGWellens|LINK
I think you are missing a backslash (Example from MSDN help:)
Jun 25, 2008 11:29 AM|prajapatiamit2003|LINK
i put space in AttachDbFilename=|DataDirectory|\Database1.mdf; then also give same error
Jun 30, 2008 08:31 AM|Jian Kang - MSFT|LINK
What is the SQL server 2005 edition in your connection string? Is it a SQL server 2005 Express edition?
We can attach or visit the database file in “App_Data” folder with “AttachDbFilename=|DataDirectory|\Test.mdf;” in SQL Server 2000 Express edition, so if it’s other editions of SQL Server, you may attach the database file in the “SQL Server Management Studio”
, then remove the “AttachDbFilename=|DataDirectory|\Test.mdf;” from the connection string and modify it as usual.
<add name="SqlServer" connectionString="Server=yoursqlservername_or_IP;
Jun 30, 2008 11:33 AM|prajapatiamit2003|LINK
Jul 01, 2008 05:59 AM|Jian Kang - MSFT|LINK
Please replace the "|DataDirectory|" with the full physical path of the database file in your original connection string, and try to check whether it works.
Hope this helps.
Jul 03, 2008 10:03 AM|prajapatiamit2003|LINK
Oct 23, 2011 02:43 AM|vnisman|LINK
I had this problem with Invalid 'AttachDbFileName' parameter
Spent couple hours trying to find any good documentation but eventually here is what seems to be going on:
I was using Data Source=localhost;AttachDbFileName=|DataDirectory|Movies.mdf;....
When I changed to Data Source=(local); or alternatively: Data Source=.; the connection worked just fine.
My conclusion is that AttachDbFileName is not supported over TCP connection used when localhost/IP is specified.
On another hand, the AttachDbFileName works fine over Named Pipes (local) or '.' (Must be on the same machine!)
Apr 18, 2013 09:14 PM|ultrafastneal|LINK
Thanks! This makes a lot of sense and saved me some time.