-2
안녕하세요, 다음 코드로 데이터베이스에 연결하려고합니다. 하지만 오류 메시지가 표시됩니다.데이터베이스를 열 수 없습니다. 사용자가 로그인하지 못했습니다.
로그인 요청한 데이터베이스 "CPL"을 열 수 없습니다. 로그인에 실패했습니다. 'Dell-PC \ Dell'사용자가 로그인하지 못했습니다.
그것은 전에 잘 작동했다. 있는 Web.Config에서
의 C# 코드
protected void Page_Load(object sender, EventArgs e)
{
string CurrentDate = DateTime.Today.ToShortDateString();
string CS = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
{
DataTable dtMatchDetails = new DataTable();
string query = "Select MatchTeam1,MatchTeam2 from tblSchedule Where MatchDate =" + CurrentDate;
SqlCommand cmd = new SqlCommand(query, con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dtMatchDetails);
con.Close();
da.Dispose();
}
연결 문자열은
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;User Instance=true;database = CPL"
providerName="System.Data.SqlClient=" />
</connectionStrings>
당신은 반드시 연결 문자열은 옳은 있습니까? –
@ SonerGönül 네, 이전에 잘 작동했습니다. – user1295408
오류의 원인은 무엇입니까? 성공적으로 연결하려는 시도와 실패한 연결 시도간에 SQL Server 또는 이와 관련된 다른 항목을 업그레이드 했습니까? 'User Instance = true'없이 연결을 시도하십시오. 또한 공급자 이름에 여분의 심볼'='이 있습니다. –