“Index 0 is either negative or above row count” error C#

前端 未结 1 582
耶瑟儿~
耶瑟儿~ 2021-01-25 00:08

I need help too much.

I am getting the following exception:

Index 0 is either negative or above row count error

I researche

1条回答
  •  不要未来只要你来
    2021-01-25 00:58

    Which means the DataView, dataw is Empty(the query returns no records) . So you have to Check for Empty before accessing the Value from it.

    DataView dataw = new DataView(ReturnTable(gmyquery));
    if (dataw!=null && dataw.Count > 0)
    {
        // Your code here
    }
    

    0 讨论(0)
提交回复
热议问题