Diễn đàn sinh viên công nghệ thông tin, chia sẻ, giao lưu, học hỏi. Kết nối ... Những ngôn ngữ cơ bản mà bạn cần phải nắm nếu muốn thành 1 lập trình viên ...VuaTenMien.Com
Chủ Nhật, 12 tháng 5, 2013
ASP.NET: Xây dựng bộ đếm cho Web (Web Counter)
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[counter]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[counter]
GO
CREATE TABLE [dbo].[counter] (
[hit] [int] NOT NULL
) ON [PRIMARY]
GO
INSERT [dbo].[counter] (hit) VALUES (1)
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[webcounter]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[webcounter]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE dbo.webcounter
AS
BEGIN
SET NOCOUNT ON
DECLARE @hits INT
update counter set hit = hit + 1
SELECT hit from counter
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
This is our ASP.NET page. Please modify database connection.
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script language="VB" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
Dim objCon As New SQLConnection("server=ASP;User id='sa';password='123';database=dotnet")
Dim cmd As SQLCommand = New SQLCommand("EXEC dbo.webcounter", objCon)
objCon.Open()
Dim r as SQLDataReader
r = cmd.ExecuteReader()
r.read()
strCounter.text = "Hit : " & r.item(0)
end sub
</script>
<html>
<head>
</head>
<body>
<asp:label ID="strCounter" runat="server"/>
</body>
</html>
Đăng ký:
Đăng Nhận xét (Atom)
Bài đăng phổ biến
-
Website-Watcher 2011 sẽ theo dõi và thông báo cho bạn biết mỗi khi trên website, forum, blog,… ưa thích có tin bài mới. Nhờ Website-Watcher...
-
So sánh 2 cách tạo stack bằng mảng và bảng kiểu cấu trúc nhé Mảng: http://codepad.org/rTA0NJgL #include <stdio.h> #include<co...
-
TÀI LIỆU TỔNG HỢP Tài Liệu Đại Học Bách Khoa Hà Nội Tài Liệu Đại Học Bách Khoa Đà Nẵng Tài Liệu Đại Học Bách Khoa HCM Tài Liệu FPT ...
-
NHẬP VÀ XUẤT DỮ LIỆU 4.1 Lệnh xuất Cú pháp : printf ("chuỗi định dạng"[, đối mục 1, đối mục 2,…]); Chức năng : Đưa ...
-
CÂU LỆNH LẶP VỚI SỐ LẦN LẶP CHƯA XÁC ĐỊNH 7.1 Lệnh while Vòng lặp thực hiện lặp lại khối lệnh trong khi biểu thức còn đúng + Cú p...
-
import java.io.*; public class Test_Ngto{ public static void main(String args[]){ InputStream is = System.in; ...
-
BritainTourist .Com PhumyGroup.com SonhaiGroup.com LiaoningGroup .Com S haanxiGroup .com EchinaTourist.com T echnologyJewelry ....
-
//Yêu cầu: Viết chương trình Console Application, tính giai thừa của N nguyên nhập từ bàn phím. GiaiThua=1.2.3.4.....N class Program { ...
-
clear declare -a a a=( [0]=$1 [1]=$2 [2]=$3 ) max=${a[0]} min=${a[0]} l=${#a[*]} for ((i=0;i<$l;i++)) do if [ $max -le ${a[i]} ...
-
using System; namespace PhuongTrinhBacNhat { class Program { static void Main(string[] args) { Console.Write(...
Không có nhận xét nào:
Đăng nhận xét