Dear Imar
thankks again
what i mean is this article ,..
http://imar.spaanjaars.com/238/howto...x-with-c-sharp
and my problem is in the global.asax.cs file .. which the code is for mdb file and and working with sql server
the code below need to be modified and im begginer and dont know how to do it
using System;
using System.Data.sqlclient;
using System.Web;
namespace HitCounters
{
public class Global : HttpApplication
{
private static int totalNumberOfUsers;
private static int currentNumberOfUsers;
protected void Application_Start(object sender, EventArgs e)
{
// Get the Total Number of Users from the database.
string sql = "SELECT NumberOfHits FROM tblUserCounter WHERE CounterType = UserCounter";
using (SqlCommand command = new SqlCommand(sql, ConnectionManager.Getconnection()))
{
reader = command.ExecuteReader(CommandBehavior.SingleResult | CommandBehavior.CloseConnection);
}
if (reader.Read())
{
totalNumberOfUsers = reader.GetInt32(0);
}
else
{
totalNumberOfUsers = 0;
}
// Close the reader and the connection
reader.Close();
cmd.Connection.Close();
}
protected void Session_Start(object sender, EventArgs e)
{
// Increase the two counters.
totalNumberOfUsers += 1;
currentNumberOfUsers += 1;
// Save the Total Number of Users to the database.
string sql = "Update tblUserCounter set NumberOfHits = {0} where CounterType = UserCounter , totalNumberOfUser";
using (sqlcommand command = new sqlcommand (sql, ConnectionManager.GetConnection())
try
{
}
catch (sqlexception ex)
{
statusLabel.Text = ex.message;
}
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
}
protected void Session_End(object sender, EventArgs e)
{
currentNumberOfUsers -= 1;
}
protected void Application_End(object sender, EventArgs e)
{
}
/// <summary>
/// Gets the total number of users that visited this web site.
/// </summary>
public static int TotalNumberOfUsers
{
get
{
return totalNumberOfUsers;
}
}
/// <summary>
/// Gets the total number of users that are currently on-line.
/// </summary>
public static int CurrentNumberOfUsers
{
get
{
return currentNumberOfUsers;
}
}
}
}