摘要:ASP.NET windows 認證連資料庫
處理電腦問題,不是一開始就狂查網路,而是要用心去仔細思考,然後再查網路,然後再判斷網路寫的對不對,然後再思考
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source=CHARLES-PC\\SQLEXPRESS;Initial Catalog=Scores;Integrated Security=True");
SqlCommand objcmd = new SqlCommand("select * from StudentScores", conn);
try
{
objcmd.Connection.Open();
objcmd.ExecuteNonQuery();
Response.Write("Success");
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
objcmd.Connection.Close();
}