Click here to Skip to main content
15,913,773 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello All
i read about classes in c# and i have question cannot solving
how the compiler exec the code with out nesting values when many user interactive with the page in same time
the code is
the page code
C#
 protected void Btn_Search_Click(object sender, EventArgs e)
    {
      string Sql_Txt = " Select * from Employee_Table where Emp_Name like                                                    '"+Txt_Emp_Name.text+"'";
            Grv_Employee.DataSource = con.SqlExec(Sql_Txt, "Emp_Info_Tbl");
            Grv_Employee.DataBind();
}
the class code 
public static class Connection
{
public static SqlConnection SQLCS = new SqlConnection(MyConnStr);
public static SqlDataAdapter SQLDA = new SqlDataAdapter();
public static SqlCommand SQLCMD = new SqlCommand();
public static DataTable SqlExec(string SqlText, string TblName)
    {
            SQLDA.SelectCommand = new SqlCommand(SqlText, SQLCS);
            SQLDA.Fill(SQLDS, TblName);
            SQLCS.Close();
        
        return SQLDS.Tables[TblName];
    }
}
Posted
Updated 17-Aug-13 23:27pm
v2

1 solution

Because each user gets a different context: the Session.
Each session has it's own memory, heap, and so forth, so they are (deliberately) independant of each other. Think of it as commuters in their cars: they are all going in the same general direction, but each can listen to a different radio station.
 
Share this answer
 
Comments
ahmed hussein khazal 18-Aug-13 5:18am    
thank you very much can i get refernce explain it plz
OriginalGriff 18-Aug-13 5:31am    
Sorry? I don't understand what you are asking for - please try again: it's probably a language problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900