2011-12-09 1 views
2

저는이 자습서를 따라 설치 프로그램을 사용하여 데이터베이스 스크립트를 설치했습니다. 그러나 SQL 로그인 자격 증명에 대해서만 작동합니다.Visual Studio에서 SQL 데이터베이스 설치 프로그램을 설치하는 방법 Windows 인증을 사용 하시겠습니까?

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

어떻게 Windows 인증 자격 증명으로이 일을해야합니까?

+0

링크가 더 이상 작동하지 않습니다. –

답변

0

C#의 경우 아래에서 시작할 수 있습니다. 연결을 열어 볼 수 있는지 확인하십시오. localhost를 사용하지 않을 경우 서버 주소로 변경하십시오.

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()); 
     } 
    } 
}