The connection string to the local database file does not work

connectionString="AttachDbFilename=C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF;Integrated Security=True; User Instance=True" providerName="System.Data.SqlClient" /> 

This is the connection string that is provided to me from Server Explorer for my local MDF file. When I try to start the application, I get the following error.

 "Format of the initialization string does not conform to specification starting at index 25." 

Does anyone know what this is?

Thanks!

+4
source share
4 answers

I would say that these are spaces in the file name. Try to include it in `` e.g.

 connectionString="AttachDbFilename='C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF';Integrated Security=True; User Instance=True" 

or copy it to c: \ for test

+2
source

Thanks to everyone. My problem was actually with the connection string in which I provided the NHibernate configuration. It seems that the path to the local data file should not be wrapped or "s". Thanks for answers.

+2
source

Try replacing: Integrated Security = True

C: Trusted_Connection = Yes

+1
source

Have you tried using escape characters on the backslash?

 connectionString="AttachDbFilename=C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF;Integrated Security=True; User Instance=True" providerName="System.Data.SqlClient" /> 

becomes

 connectionString="AttachDbFilename=C:\\Documents and Settings\\nmartin\\My Documents\\PS_Upload\\TimeTrack\\src\\TimeTracker\\TimeTrack\\App_Data\\ASPNETDB.MDF;Integrated Security=True; User Instance=True" providerName="System.Data.SqlClient" /> 
0
source

All Articles