首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

There is no row at position 0是什么有关问题(解决立刻给分)?

2012-01-20 
There is no row at position 0是什么问题(解决立刻给分)???DataTabledtnewDataTable()stringmysqlsel

There is no row at position 0是什么问题(解决立刻给分)???
DataTable   dt=   new   DataTable();
string   mysql   =   "select....... ";
dt=   GetDBData(mysql);
int   DataRows   =   dt.Rows.Count;
int   aaa   =   int.Parse(dtTempUnitData.Rows[0][0].ToString());
//////////
我在sql里用query工具查出来上面的mysql是可用的,而且DataRows也不为0,为什么报错There   is   no   row   at   position   0
谢谢知道的回答一下哦~~

[解决办法]
dtTempUnitData是个DataTable吗?它的内容可能是空的!
[解决办法]
int aaa = int.Parse(dtTempUnitData.Rows[0][0].ToString());你这里的dtTempUnitData是不是一个你上面的DataTable啊?是这里写错了吧,如果不是你把代码写全一点。
[解决办法]
GetDBData得到的内容为空DataRows估计为0,你再查查啊~

热点排行