错误提示:System.IndexOutOfRangeException: 无法找到表 0
一般出现这种情况就是没有查出来数据,需要加个判断
其中需要的判断如下
if(ds == null)//ds为空
if(ds.Tables.Count == 0)//ds中没有表 ds.talbe[0]错误时无法找到表0
if(ds.Tables.Count == 1 && ds.Tables[0].Rows.Count == 0)//ds中的表没有数据
希望能对碰到这类错误的童鞋们有所帮助
错误提示:System.IndexOutOfRangeException: 无法找到表 0
一般出现这种情况就是没有查出来数据,需要加个判断
其中需要的判断如下
if(ds == null)//ds为空
if(ds.Tables.Count == 0)//ds中没有表 ds.talbe[0]错误时无法找到表0
if(ds.Tables.Count == 1 && ds.Tables[0].Rows.Count == 0)//ds中的表没有数据
希望能对碰到这类错误的童鞋们有所帮助