I would like to connect to an instance of SQL server over the network (or VPN) using Windows integrated security.
What steps exactly are necessary for me to accomplish this? I am using Winforms.
I would like to connect to an instance of SQL server over the network (or VPN) using Windows integrated security.
What steps exactly are necessary for me to accomplish this? I am using Winforms.
You need to provide a connection string from a config file and use this to create an SQL connection; a typical example for integrated security might be:
Persist Security Info=False;
User ID=frosty;Password=flakes;
Initial Catalog=milkjug;
Data Source=supermarket
Integrated Security=True;
provider=System.Data.SqlClient;
Where 'supermarket' is your fully qualified database name (or IP address); this can also include port numbers.
In your code a block like the following:
SqlClient.SqlConnection myConnection = New SqlClient.SqlConnection();
myConnection.ConnectionString = myConnectionString;
myConnection.Open();
The above is not tested and is from memory - should do the trick or at least point you in the right direction.