roy himanshu

roy himanshu

  • NA
  • 126
  • 0

can i add new column in table through gridview?

Sep 9 2009 4:04 AM

hi .all
can i add new column in data table through gridview  when form load?is it possible? plz tell how is it possible .my code is paste bellow.
private
void Form3_Load(object sender, EventArgs e)
{
cn =
new SqlConnection("data source=server2;database=costing1;user id=sa;password=sa");
da =
new SqlDataAdapter("select *from Itemmaster", cn);

DataTable dt = new DataTable();
dt.Columns.Add(
"column005", typeof(int));
ds =
new DataSet();
da.Fill(ds,
"Itemmaster");
cmd =
new SqlCommand();
cmd.Connection = cn;
cmd.CommandType =
CommandType.StoredProcedure;

dataGridView1 .DataSource =ds .Tables [
"Itemmaster"];
}

 

Answers (1)