I am having errors running my windows form application on the client computer. I have a database called LoginData.mdf which is a LocalDB, and i want to attach it to my published project. Here is my connection string
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + Globals.login_DB_path + @"\" + Globals.login_Db_name + ";Integrated Security=True;Connect Timeout=30;");
where
public static class Globals
{
public static String login_DB_path = "|DataDirectory|";
//Path.GetFullPath(Environment.CurrentDirectory);
public static String login_Db_name = "Logindata.mdf";
}
I have already looked at this thread : publish a project with local database
but when i install the entire folder in my client computer and set it up, after I open my click once application from the created an app folder which looks like:
-Application Files
Bombardier Manager_1_0_0_1
Bombardier Manager.exe.config.deploy
Bombardier Manager: click once app
.... the .mdf and log.ldf are also her
-Bombardier Manager: click once app
-setup
I setup the file on the client computer intially and it downloaded the SQL Server Express Local DB and the .NET framework on the client computer as i put t hem as prerequisites, I also added the Data Files in the Application files section.
After the setup I double clicked the click once app in the main folder. It ran but gave me the error that it couldn't access the sql database; that is already included in the application. Also then later when I tried to run the click once app from the Bombardier Manager_1_0_0_1 folder it said that i couldn't run it from there since it had been installed from somewhere else. I dont understand what to do since I followed all the steps in the given link above but it still gives me the same errors as before that the SQLDatabase is not accessible.
Any help would be appreciated.