The Code Behind of the Button Click Event
protected void btnCustomerID_Click(object sender, EventArgs e)
{
Customer objCustomer=new Customer();
//gv=GridView
gvCustomers.DataSource = objCustomer.Select();
gvCustomers.DataBind();
}
The DataSet Method in a Seperate Class
SqlConnection conn=new SqlConnection("server=sheeban\\sqlexpress;integrated security=SSPI;database=northwind");
SqlCommand cmd = new SqlCommand("SELECT * FROM customers", conn);
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
No comments:
Post a Comment