Code:
if (!IsPostBack)
{
string chuoikn = "server=localhost;database=webbandt;uid=;pwd=;integrated security=true;";
SqlConnection c = new SqlConnection(chuoikn);
c.Open();
try
{
string chuoitruyvan = "update luottruycap set dem=dem + 1";
SqlCommand m = new SqlCommand();
m.Connection = c;
m.CommandText = chuoitruyvan;
m.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write("Thông Báo Lỗi:" + ex.Message);
}
c.Close();
}
Em viết code như vậy có đúng không mà sao f5 hay chuyển qua trang khác thì tự động nó tăng lên 1.
Lúc dùng Application["dang"] cộng thì nó cũng vậy.
Anh/chị coi dùm em.Em cám ơn