我怎样才能解决这个错误:找不到表0.?可能是什么原因? [英] How can i solve th error :Cannot find table 0.? what could be the reason?
本文介绍了我怎样才能解决这个错误:找不到表0.?可能是什么原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么能错过这个错误:找不到表0.?可能是什么原因?
在此代码中出错,
DataSet xxx = new DataSet();
dt = xx.Tables [0] .DefaultView.ToTable(true,Fieldname);
请帮帮我。
提前非常感谢
解决尝试:
DataSet dataSetObject = new DataSet();
sqlDataAdapterObject.Fill(dataSetObject);
DataTable dataTableObject = dataSetObject.Tables [ 0 ]。DefaultView.ToTable( true , Fieldname);
绑定数据集的位置,设置断点并查看。您的数据集为空,这就是它无法找到表0的原因。
例如,如果您使用过程来获取数据并且您绑定到数据集,那么您的过程不是返回任何一行。
原因可能是你写的
xx.Tables [0 ]
而不是
xx .Tables [0]
很难说更多,因为你提供的代码甚至无法编译。
>
How can i sove th error :Cannot find table 0.? what could be the reason?
getting error in this code,
DataSet xxx= new DataSet();
dt = xx.Tables[0].DefaultView.ToTable(true, "Fieldname");
Please help me.
A big thanks in advance
解决方案
try this:
DataSet dataSetObject = new DataSet(); sqlDataAdapterObject.Fill(dataSetObject); DataTable dataTableObject = dataSetObject.Tables[0].DefaultView.ToTable(true, "Fieldname");
The place where you are binding your dataset, put a break point and see. Your dataset is empty, that''s why it cannot find table 0.
For example if you are using a procedure to get the data and that you are binding to the dataset, then your procedure is not returning any row.
The reason could be that you wrote
xx.Tables["0"]
instead of
xx.Tables[0]
Difficult to say more, as the code you provided would not even compile.
这篇关于我怎样才能解决这个错误:找不到表0.?可能是什么原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文