How to copy DataGridView contents to Dataset?

You need to first create a DataRow type and add it into your DataTable before you can start assigning to it.

You need to first create a DataRow type and add it into your DataTable before you can start assigning to it. So your code will now be something like: DataSet ds = new DataSet(); DataTable dt = new DataTable("ProdFromDGV"); ds.Tables. Add(dt); foreach (DataGridViewColumn col in dataGridView1.

Columns) { dt.Columns. Add(col. HeaderText, typeof(string)); } foreach (DataGridViewRow row in dataGridView1.

Rows) { foreach (DataGridViewCell cell in row. Cells) { // This will not work, but it's something similar to this that you need here... DataRow row = new DataRow(); dt.RowCollecion. Add(row); // Now you can assign to the row.... dt.Rowsrow.Indexcell.

ColumnIndex = cell.Value.ToString(); } } dt. WriteXml("table. Xml"); Hope this helps some..

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions