Get Paid By Click

Mginger Mobile Money

Jan 5, 2010

Datagridview Operation - Tips,To Set Datasource for a datagridview in c#

Datagridview Operation - Tips

To Set Datasource for a datagridview in c#
  SqlConnection con = new SqlConnection(connectionstring )
  SqlCommand cmd = new SqlCommand(commandText))
  SqlDataAdapter da = new SqlDataAdapter(cmd))
  DataSet ds = new DataSet();
  da.Fill(ds);
  if (datagridview1.Rows.Count > 0)
  {
  datagridview1.DataSource = null;
  datagridview1.Rows.Clear( );
  }
  datagridview1.DataSource = ds.Tables[0];
   

Easy Way To Pay

Sign up for PayPal and start accepting credit card payments instantly.

Earn While Searching