protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindData();
}
}
public void BindData()
{
con = new SqlConnection(@"Data Source=localhost\SQLEXPRESS;initial Catalog=Demo1;integrated security=true;");
cmd.CommandText = "select a.Emp_Name,a.Emp_Id,a.Emp_City,a.Emp_State,b.Emp_Salary From Emp_Details AS a INNER JOIN Emp_Salary AS b ON a.Emp_Id= b.Emp_Id";
//cmd.CommandText = "select a.Emp_Name,a.Emp_Id,a.Emp_City,a.Emp_State,b.Emp_Salary From Emp_Details AS a ,Emp_Salary AS b where a.Emp_Id=b.Emp_Id AND b.Emp_Salary>=32000";
//cmd.CommandText = "Select * from Emp_Details";
cmd.Connection = con;
da = new SqlDataAdapter(cmd);
da.Fill(ds);
con.Open();
cmd.ExecuteNonQuery();
Grid.DataSource = ds;
Grid.DataBind();
con.Close();
}
No comments:
Post a Comment