找不到表0。

编程入门 行业动态 更新时间:2024-10-22 21:41:37
本文介绍了找不到表0。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Hello All, 我正在将xml转换为数据集,但在服务器上我遇到了无法找到表0的问题,因为我在本地计算机上检查了它没有在这里复制它,但在生产中我会得到这个错误有时但不是连续的。我正在编写将xml转换为数据集的行。请帮助解决问题。

Hello All, I am converting xml to dataset but on server I am getting issues of can not find table 0 as I have checked it on local machine but didn't replicate it on here but on production I will get this error some times but not continuously. I am writing the lines that will convert xml to dataset. Please help to resolve the issue.

String xmlString = loaddata; System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(new System.IO.StringReader(xmlString)); reader.Read(); System.Data.DataSet dsData = new System.Data.DataSet(); dsData.ReadXml(reader, System.Data.XmlReadMode.Auto); reader.Close();

谢谢, Amit Mehan 我的尝试: 我试过以下代码也没有解决我的问题..

Thanks, Amit Mehan What I have tried: I have tried the below code as well but doesn't solve my issue..

if (dsData.Tables.Count > 0) { if (dsData.Tables[0] == null) { reader = new System.Xml.XmlTextReader(new System.IO.StringReader(xmlString)); reader.Read(); dsData = new System.Data.DataSet(); dsData.ReadXml(reader, System.Data.XmlReadMode.Auto); reader.Close(); } }

推荐答案

你好, 这是清除你的 DataSet 是空的还是null。因此它无法找到任何表。像这样修改你的代码 Hello , This is clear that your DataSet is blank or null .Hence it can not find any table . Modify your code like this way if(dsData !=null && dsData.Tables.Count > 0) { //do other stuff }

谢谢

Thanks

更多推荐

找不到表0。

本文发布于:2023-07-04 17:11:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1026898.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!