Table.Rows.Count发出异常 [英] Table.Rows.Count rasing an exception
问题描述
我有从数据表加载数据的函数
public bool LoadFromDataTable(DataTable Table)
{
if(Table.Rows.Count> 0)
{
return(Automation.SetObjectFieldsFromDataRow(this,Table.Rows [0])> 0); < br>}
return false;
}
我得到一个"在0位没有行"。 if语句上的错误....当然这不可能是????
有什么我做错的吗?
谢谢
Hi,
I have function that loads data from a datatable
public bool LoadFromDataTable(DataTable Table)
{
if (Table.Rows.Count > 0)
{
return (Automation.SetObjectFieldsFromDataRow(this, Table.Rows[0]) > 0);
}
return false;
}
I get a "There is no row at position 0." error on the if statement.... Surely this can not be????
Is there anything that I am doing wrong?
Thanks
推荐答案
一个建议是你可以调试你的代码到它调用这个方法的地方,和检查代码如何获取数据表(等等,查询语句是什么)。您的查询代码可能会对返回的数据表产生影响。
One suggestion is that you may debug your code to where it's calling this method from, and check the code how to get the datatable (etc., what's the query statement). There may be impact with your query code for returned datatable.
>
这篇关于Table.Rows.Count发出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!