且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将数据表加载到xml中,然后将xml重新加载到数据表中

更新时间:2021-07-17 04:08:05

这是您要执行的操作,以便无论是否存在行数据,都可以显示列.该模式将保留数据表元数据.只需确保将XmlWriteMode和XmlReadMode设置为Schema

This is what you need to do in order for columns to be displayed regardless if there is row data or not. The Schema will preserve the data table meta data. Just make sure there is a XmlWriteMode and XmlReadMode set to Schema

ds.WriteXml(sReader, XmlWriteMode.WriteSchema);
ds.ReadXml(sReader, XmlReadMode.ReadSchema);

这将保留所有表数据,包括列名和列数据类型.

This will retain all table data including Column name's and Column data type.