Asp.Net > Code Snippets
ASP.NET Web Counter
ASP.NET 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" %>
Asp Codes
ActiveX
ADO
Array
Code Snippets
Components
Data Access
Date Time
Files
Graphics
HTML Formatting
Mathematics
Miscellaneous
Sessions
SQL
Strings
Techniques
XML