AuthorQuestion
convert data table to dataset in c#.net
Posted on: 14 Dec 2012
hi
can any one help me
how to convert data table to data set
or gridview to dataset



Thanks & Regards
Kumar

Thanks & Regards
Ravi Kumar

[ + ]
AuthorReply
Re: convert data table to dataset in c#.net
Posted on: 14 Dec 2012  
You cannot convert datatable to dataset. Dataset is a container which can hold many datatables.

You can create new dataset and add your datatable to it.

DataSet ds=new DataSet();
ds.Tables.Add(dt);

here dt is my datatable.

Thanks & Regards,
Santhosh

Please mark this answer as accepted answer if it resolves your problem.
Re: convert data table to dataset in c#.net
Posted on: 14 Dec 2012  
hi santhosh
can u help me how to assign datagridview data to data set or data table


Thanks & Regards
KUmar

Thanks & Regards
Ravi Kumar

Re: convert data table to dataset in c#.net
Posted on: 14 Dec 2012  
hi this is the way to convert datagridview to dataset DataSet ds2 = ((DataView)dataGridView1.DataSource).Table.DataSet;
Thanks & Regards
Ravi Kumar

Re: convert data table to dataset in c#.net
Posted on: 14 Dec 2012  
data bind in gridview
  SqlConnection con; 
  SqlCommand com; 
  SqlDataAdapter DA; 
 
 
  con = new SqlConnection(); 
  con.ConnectionString =  ConfigurationManager.ConnectionStrings["AppConnect"].ConnectionString; 
  con.Open();
  com = new SqlCommand(); 
  com.CommandText = "SELECT T* FROM PRODUCTS"; 
  com.CommandType = CommandType.Text; 
  com.Connection = con; 
 
  DA = new SqlDataAdapter(); 
  DA.SelectCommand = com; 
      DataSet ds = new DataSet();
  DA.Fill(ds); 
 
  GridView1.DataSource = ds; 
  GridView1.DataBind(); 
 
  DA.Dispose(); 
  con.Dispose(); 
  con.Dispose(); 

Thanks & Regards, Vishnujeet
Re: convert data table to dataset in c#.net
Posted on: 14 Dec 2012  
this is wrong
Thanks & Regards
Ravi Kumar

Nevron Chart
SPONSORED BY
HTML 5 + JQUERY CONTROLS