I downloaded SQL Server Management Studio (SSMS). I can connect with local database using Windows Authentication, but I would like to connect with my C# app using connection string.
I check SQL Server Authentication mode here:
I went to Users
tab of my new created database. But I can't add new user. It says that I don't have permission.
I also went to sys
user properties, but I can't change password anywhere:
So what should I do? I want to connect with database on VPS with my c# app.s
If you want to use the current user that is logged in (Windows Authentication) then you setup the connection string as follows:
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
If you mean that you want to use a SQL Authenticated account, you need to add the SQL login and user, map it to the database you want, and then you can use the following syntax:
Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
You can search for more documentation on setting up your App.Config file to have connection strings, and any tweaks to the connection string itself can be found at:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.