My primary coding ideal is on .net applications.. So I have limited skill with application design.
I am trying to export an entire table from a database (Using a view) t
You can use a SqlDataAdapter
and System.Data.DataSet
to load a DataTable
, which will write to XML.
const string strSql = "SELECT * FROM vwGetStaffDetails";
using (SqlCommand sqlComm = new SqlCommand(strSql, DataConn.Connect()) { CommandType = CommandType.Text })
{
SqlDataAdapter da = new SqlDataAdapter(sqlComm);
DataSet ds = new DataSet();
da.Fill(ds);
ds.Tables[0].WriteXml(@"C:\Temp\text.xml");
}
Edit Using this method you'll remove the XML code from SQL and let .NET convert everything. I've changed your SQL command to reflect this.