1

How can create connection string for production mode using c# and WPF Application. Now I used this connection string, and Windows Authentication in developer mode. And is working good.

<connectionStrings>
<add name="SensorSystem" connectionString="Data Source=DEVELOPMENT\SQLEXPRESS;Initial Catalog=SensorSystem;Integrated Security=True"
  providerName="System.Data.SqlClient" />

For testing my application is working in the computer very well. But when is finish and database add in the server and application install in another computer is need SQL Authentication for better security and different connection string (I think).

Evgeni Velikov
  • 362
  • 3
  • 10
  • 28
  • 1
    The syntax of SQL Server connection strings is very well documented. Did you try googling for this? PS. SQL Authentication results in **worse security** as the username/password have to be stored somewhere. You also *don't* have control over who uses these credentials and how. Changing passwords periodically is also a *big pain*, first because you don't know *who* uses the account, second because you have to change each individual application setting – Panagiotis Kanavos Oct 05 '15 at 07:49
  • 1
    You don't need SQL Authentication to connect to a remote computer. Windows Authentication will work just as well, as long as the user running the application has permission to connect to the database. In a Windows Domain you can add each individual user, or put all users in a Group and add the *group* to the database. – Panagiotis Kanavos Oct 05 '15 at 07:58
  • 1
    One solution is to use the SqlConnectionStringBuilder instead of handcrafting it. – BDH Oct 05 '15 at 08:01
  • I try googling for this. And find SQL Authentication is with username and password. Now when I open SQL management studio for windows authentication is not need username and password. And for security I think is good to use SQL Authentication, because is want username and password. – Evgeni Velikov Oct 05 '15 at 08:14

1 Answers1

2

checkout https://www.connectionstrings.com/sql-server/ for all your connection string needs.

you need to remove integrated security = True and add

user id=mylogon;password=mypassword;

Jay
  • 2,077
  • 5
  • 24
  • 39