private void databasexml_Click(object sender, EventArgs e) { string sql = "SELECT * FROM BookDetails"; DataSet ds = new DataSet(); BindingSource bs = new BindingSource(); SqlDataAdapter sda = new SqlDataAdapter(sql, stringConnection); try { ds.WriteXml("C:\\Users\\Louise Tooze\\Desktop\\XMLFile2"); dataGridView1.DataMember = "BookDetails"; sda.Fill(ds); dataGridView1.DataSource = ds; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.Update(); sda.Update(ds); sda.Dispose(); MessageBox.Show("XML File created Successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
new DataSet
ds
DataSet
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)