intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

ASP.NET 4 Unleased - p 152

Chia sẻ: Yukogaru Yukogaru | Ngày: | Loại File: PDF | Số trang:10

53
lượt xem
5
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Working with the HTTP Runtime private private private private string _conString; SqlConnection _con; SqlCommand _cmdSelect; SqlCommand _cmdInsert; public override void Init() { // initialize connection _conString = ➥WebConfigurationManager.ConnectionStrings[“Log”].ConnectionString; _con = new SqlConnection(_conString); // initialize select command _cmdSelect = new SqlCommand(“SELECT COUNT(*) FROM Log WHERE Path=@Path”, ➥_con); _cmdSelect.Parameters.Add(“@Path”, SqlDbType.NVarChar, 500); // initialize insert command _cmdInsert = new SqlCommand(“INSERT Log (Path) VALUES (@Path)”, _con); _cmdInsert.Parameters.Add(“@Path”, SqlDbType.NVarChar, 500); } public int NumberOfRequests { get { int result = 0; _cmdSelect.Parameters[“@Path”].Value = Request.AppRelativeCurrentExecutionFilePath; try { _con.Open(); result = (int)_cmdSelect.ExecuteScalar(); } finally { _con.Close(); } return result; } } void Application_BeginRequest(object sender,...

Chủ đề:
Lưu

Nội dung Text: ASP.NET 4 Unleased - p 152

ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2