Publish c# windows form application with localDB

c publish localdb
how to deploy c# windows application with sql server database
create local database visual studio 2017
how to publish windows application in visual studio 2019
how to create database in c# windows application
c# local database
application with local database
c# desktop application with database

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.

Did you include the database as "Application File"? If not do the following (at least this is how I am doing it):

Project -> Properties -> Publish -> Application Files

Check This

Deploy Windows Form application with local database visual studio , In this tutorial you will learn how to make setup of windows form application for deployment. To Duration: 18:12 Posted: Feb 9, 2018 application is developed by C# windows form using visual studio .net 2013 (.NET 4.5) Setup project is used by "Setup and Deployment" of visual studio; Application is using local database by visual studio; This is my first time of publishing an actual software sorry for any lack of information; Thanks for your help

I don't know if this will help, but have you tried to have you .mdf, for example, in the same directory as the program. Then just make the connection string from the .config file in Settings Like this

This worked for me, making conn simple with LocalDB.

Deploy windows form c# with local database, application is developed by C# windows form using visual studio .net 2013 (.NET 4.5); Setup project is used by "Setup and Deployment" of visual  In this tutorial you will learn how to make setup of windows form application for deployment. To download visual studio installer just type (visual studio (your visual studio version like:2013

How to Publish a windows application with the new LocalDB?, Windows Forms. > I have been building windows applications with embedded MDF files for a while now. Is it possible to publish an application with an embedded MDF that uses LocalDB but does not force the clients to  0 down vote favorite I develope c# windows form application in visual studio 2015 who is connected to a sql server express 2014, application with simple read and write data to database who have only one table, and now I want to put both in same instalation and deploy it on another PC ' s with OS Windows 10, so user can install application with one click setup, next, next, finish.

how can i deploy windows C# application with its local database SQL, You would need to create a setup that creates/deploy database along with your application install. Have a look at these: Creating setup With  Advanced Installer ===== https://goo.gl/ybSEPe Free cool icons ==== https://goo.gl/5StVaz Full Project === https://goo.gl/u9cfA4 c# create setup project, sql database

Publishing Windows Form Application On Desktop, How do you deploy an application with SQL Server database on clients? Here I will explain how to use .SDF local database file in your window application. I will also explained how to save record and update record in local database. I will explain these points: How to add Sdf file in application? How to create table in SDF Database? How to save Data in SDF database table? Step 1: How to add Sdf file in application?

Using Advanced Publish Settings for Visual Studio Database Project, How do I publish a Windows Form application in Visual Studio 2017? Yes, if you really want to use LocalDB, otherwise SQL Server doesn't have to be installed on that system, but the system needs to be able to communicate with some system that has SQL Server with the database attached. If this software is for someone else, then allow them to provide the SQL Server instance (a client may already have SQL Server

Comments
  • is the .mdf in a folder DataDirectory on your client or is it next to the executable? Also does the /bin/Release of your project look like the Folder/File Structure you get after installation in the AppData folder?
  • Check my question again, I did all that is mentioned in that link that you said, i have also included it in my question
  • ohh sorry @HelpSeekerandGiver
  • If you check my question, that is exactly what I have done