2

I have been following this tutorial to install the database script using a setup. But it only works for the SQL login credentials.

Walkthrough: Using a Custom Action to Create a Database at Installation

How do I make this work with Windows Authentication credentials?

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
user966614
  • 171
  • 1
  • 2
  • 9

1 Answers1

0

For C# you can start below: See if you can get a connection to open. If you are not using localhost change it to server address.

public class SQLconn{
    public  SqlConnection myConnection = new SqlConnection("user id=xxx;" +
                                       "password=xxx;server=localhost;" +
                                       "Trusted_Connection=yes;" +
                                       "database=dbname; " +
                                       "connection timeout=30");
    public void connect(){
      try {
         myConnection.Open();
      }catch (Exception e){
         MessageBox.Show(e.ToString());
      }
    }
}
Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
Sam
  • 946
  • 3
  • 11
  • 22