Posted on: 7/13/2013 2:46:44 AM | Views : 232

Hi, this is my global.aspx.cs file
public class Global : System.Web.HttpApplication { private static int totalNumberOfUsers = 0;
protected void Application_Start(object sender, EventArgs e) { // Get the Total Number of Users from the database. SqlCommand cmd = new SqlCommand(); SqlConnection conn = new SqlConnection(); string sqlText = @"SELECT BookViewCount FROM Book WHERE BookRecordId=@inBookRecordId"; conn.ConnectionString = "server=DIT-NB1231241\\SQLEXPRESS3;database=WEBA_Assignment_Database;Integrated Security=True"; //setup the SQL in the cmd object cmd.CommandText = sqlText; cmd.Connection = conn;
cmd.Parameters.Add("@inBookRecordId", SqlDbType.Int); cmd.Parameters["@inBookRecordId"].Value = inBookRecordId;
// Open the connection, and execute the SQL statement. cmd.Connection.Open(); SqlDataReader reader = cmd.ExecuteReader(); if ...

Go to the complete details ...