Firstly I'd suggest usiong a verbatim string literal so you don't have to double-up your slashes.
Secondly, if you want to access a database in the current user's My Documents folder then I suggest that you don't hard-code it:C# Code:
SqlConnection thisConnection = new SqlConnection(string.Format(@"Data Source=.\SQLEXPRESS;AttachDbFilename={0}\GymData3.mdf;Integrated Security=TrueUser Instance=True", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)));




Reply With Quote