如果列中没有数据,.LoadDataSet 不会生成 DataSet 列
我一直在网上搜索,但似乎找不到这个问题的答案。我希望这里有人能帮助我解决这个问题。
我有以下 C# 代码片段:
strCompany = "select * from Company ";
db2.LoadDataSet(db.GetSqlStringCommand(strCompany), ds, "Company");
该代码将根据 Company 表中的信息为我创建一个 dataSet
...没问题。问题源于这样一个事实:Company
表中的一列(即:Address
)中没有数据...该特定列中的所有数据是NULL
。
因此,当创建数据集时,dataSet
中缺少此列(即:Address
)。当我尝试从此 dataSet
生成 Xml 文档时,Xml 中没有元素。
有没有办法让这个 .LoadDataSet
(或其他一些方法)生成数据,以便当我去创建 Xml 文件时会有一个
元素?I have been searching the web but cannot seem to find an answer to this question. I'm hoping that someone here can help me with this.
I have the following snippet of code in C# :
strCompany = "select * from Company ";
db2.LoadDataSet(db.GetSqlStringCommand(strCompany), ds, "Company");
The code will create a dataSet
for me based on the information in the Company table...no problem. The problem comes from the fact that one of the columns (i.e.: Address
) in the Company
table has no data in it...all of the data in this particular column is NULL
.
So, when the dataSet is created, this column (i.e.: Address
) is missing from the dataSet
. When I try to generate an Xml document from this dataSet
, there is no element in the Xml.
Is there a way to make this .LoadDataSet
(or some other method) generate data so that there will be an <Address>
element when I go to create the Xml file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论