Table.Rows.Count发出异常 [英] Table.Rows.Count rasing an exception

查看:173
本文介绍了Table.Rows.Count发出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有从数据表加载数据的函数

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆