here is a small example.
SqlCommand theSQLCommand = new SqlCommand("SELECT * FROM tableName");
theSqlCommand.Connection = new SqlConnection(connectionString);
DataSet theDataSet = new DataSet();
SqlDataAdapter theSqlDataAdapter = new SqlDataAdapter(theSqlCommand);
theSqlCommand.Connection.Open();
theSqlDataAdapter.Fill(theDataSet);
theSqlCommand.Connection.Close();
theDataSet.WriteXml(filename);
you would need to import/use the System.Data.Net; namespace
does this help? This is just a small example on retrieving all records from a table and filling the dataset with the results, finally saving it to a file giving it the filename. You can get the tableName automatically generated by looking at the Table property in the DataSet:
theDataSet.Tables[index].TableName;