无法给予条件 [英] unable to give condition

查看:80
本文介绍了无法给予条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

if(dt.Rows [0]!= null)



如果条件满足wii则返回其他返回



给出错误,位置0没有值

if (dt.Rows[0] !=null)

if condition satisfy it wii enter else return

its giving error there is no value at position 0

推荐答案

看起来你的dt.Rows是空的,意思是不包含行。您可以通过检查dt.Rows.Count来验证这一点。确认后,你需要找到表没有行的原因。


我希望这会有所帮助。
It Looks like your dt.Rows is empty, means does not contain rows. You can verify this by checking dt.Rows.Count. After confirming this, you Need to find the reason why the table does not have rows.

I hope this helps.


错误几乎是不言自明的:位置0没有值 - 意思是,你的数据表不包含任何记录/行。



解决方法 -

Error is pretty much self-explanatory: "there is no value at position 0" - Meaning, your datatable doesn't contain any records/rows.

Workaround-
if(dt.Rows.Count > 0)
{
    if (dt.Rows[0] !=null)
    {
        // do something awesome here
    }
}





-KR



-KR


这篇关于无法给予条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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