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]; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)