deploy winform application connected to MSSQL server

ravi kumar 331 Reputation points

hello all ,

i have now completed building my first ever simple winform application which is aimed for data entry.

the application is built using visual studio 2019 connected to MSSQL server 2012 which is installed on my system.

i need to now deploy this application and install the same in 4-5 systems , where the data entry done by them through my app should be updated in my MSSQL server (as they don't have mssql server installed)

this is my connection string:

    <add name="dbcs" connectionString="Data Source=LENOVO\SQLEXPRESS;Initial Catalog=SQCData;User ID=ABCDE;Password=*****;Integrated Security=True"
        providerName="System.Data.SqlClient" />

can anybody please guide me how to do the same ..(any link for video or blog tutorial will also suffice)
kindly ask me if anything else is needed..

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,823 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,588 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Karen Payne MVP 35,031 Reputation points

    Hello @ravi kumar

    See the following for working through installing SQL-Server Express edition. In regards to the connection string, remove LENVO and use (all code that follows is in C#)

    connectionString="Data Source=.\SQLEXPRESS;  

    Then for user id and password, if you must encrypt both and used code as found here to encrypt/decrypt. Even better is to setup windows authentication so there is no need for user id and password. See the following for how to create a user with password.

    Also, an alternate for .NET Core Windows Forms is to use appsettings.json as described here. This article describes how to using Entity Framework while the same will work for non entity framework.

    Create a private string variable e.g. private static string _connectionString then get the connection string

    _connectionString = Helper.GetConnectionStringSecure();  

    appsettings.json would use the following (in this case for a user created as per above so no user id or password is needed)

      "database": {  
        "DatabaseServer": ".\\SQLEXPRESS",  
        "Catalog": "SQCData",  
        "IntegratedSecurity": "true"  

    VB.NET Code

    Just created a simple code sample that uses the C# library mentioned above

  2. ravi kumar 331 Reputation points

    hello @Karen Payne MVP sorry for being less clear in the question ..let me explain further so that you can help me ..

    1. I have installed SQLEXPRESS in my system and built an app (winforms) in visual studio by creating a database in my sqlserver.
    2. Now my application is complete , i have to install my app on my client(4-5 pc) all or on the same LAN and after installation when the user is trying to connect to my database located in my system he is getting below error: System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
      at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)

    By searching online , i followed below points:

    1. I have enabled Remote connection in my SSMS
    2. I have TCP/IP in sql server configuration manager
    3. I have created rule in firewall to allow port 1433
    4. i then restarted sql server configuration manager
    5. But when i opened TCP/IP window of Protocols of SQLEXPRESS in my sql server configuration manager , at the bottom TCP dynamic port was 12345(filled with other number) and my TCP port was empty.
    6. I gain changed the TCP port to 1433 and cleared the number in TCP dynamic port and restarted SQL server services.

    After all this when i reinstall the app in my client system i am getting the same error again , so please guide me if i am missing anything. And how to deploy winform Make Application With Database Can Access in Many Computers?