System.IndexOutOfRangeException: 无法找到表 0解决办法
2012-06-07 14:10
417 查看
错误提示: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中的表没有数据
希望能对碰到这类错误的童鞋们有所帮助
一般出现这种情况就是没有查出来数据,需要加个判断
其中需要的判断如下
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中的表没有数据
希望能对碰到这类错误的童鞋们有所帮助
相关文章推荐
- java.lang.IllegalArgumentException: pointerIndex out of range两种解决办法
- java.lang.IllegalArgumentException: pointerIndex out of range 问题的两种解决办法
- java.lang.IllegalArgumentException: pointerIndex out of range两种解决办法
- java.lang.IllegalArgumentException: pointerIndex out of range 问题的两种解决办法
- java.lang.IllegalArgumentException:pointerIndex out of range问题的两种解决办法
- C# B/S程序中使用DropDownList出现System.ArgumentOutOfRangeException: “DropDownList1”有一个无效 SelectedValue,因为它不在项目列表中的解决方法
- 解决java.lang.IllegalArgumentException: pointerIndex out of range的错误
- C#打开tif文件时内存溢出(System.OutOfMemoryException)解决办法
- eclipse Java文件打开异常解决方法 :java.lang.StringIndexOutOfBoundsException: String index out of range: 26
- .net发生类型为 System.OutOfMemoryException 的异常解决办法
- Android Studio 2.0+发布APK出现ExternalSystemException: String index out of range: -123错误
- SQL SERVER 导入.sql文件 出现SYSTEM.OUTOFMEMORY EXCEPTION 异常解决办法
- System.IndexOutOfRangeException: 在位置 0 处没有任何行。
- 【解决问题.思路篇】StringIndexOutOfBoundsException:String index out of range: -1
- 解决java.lang.IllegalArgumentException: pointerIndex out of range 或者 arrayindexoutofboundsexception的错误
- c#中 Exception of type 'System.OutOfMemoryException' was throw的解决办法
- Lucene.Net 的“System.IndexOutOfRangeException: 索引超出了数组界限”错误
- c#中 Exception of type 'System.OutOfMemoryException' was throw的解决办法
- 解决java.lang.IllegalArgumentException: pointerIndex out of range 或者 arrayindexoutofboundsexception的错误
- “System.IndexOutOfRangeException”类型的异常在 Stores.dll 中发生,但未在用户代码中进行处理