SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Master"].ConnectionString);
SqlTransaction tran=null ;
SqlCommand cmd;
SqlDataAdapter adp;
DataSet ds;
public void BindGridview(GridView gr, string table, string sorting)
{
adp = new SqlDataAdapter("Select * from " + table + " order by " + sorting ,con );
ds = new DataSet();
adp.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
gr.DataSource = ds.Tables[0];
gr.DataBind();
}
else
{ //Empty grid view
}
}
Wednesday, July 28, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment