今天在使用SqlDataReader 读取记录时,竟然出现了如下异常:

Invalid attempt to read when no data is present. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Invalid attempt to read when no data is present.

Source Error: 


Line 106:                if (dr.HasRows) {
Line 107:                    link = new Link(id);
Line 108:                    link.Name = dr.GetString(1);
Line 109:                    link.URL = dr.GetString(2);
Line 110:                    link.Description = SqlHelper.GetStringOrNull(dr, 3);
 

找了半天,终于发现是自己犯糊涂了,竟然没有调用:dr.Read()

转载于:https://www.cnblogs.com/Jinglecat/archive/2007/01/24/629445.html

Invalid attempt to read when no data is present.相关推荐

  1. cid unmatched [object Object] at view.umd.min.js:1 TypeError: Invalid attempt to destructure non-ite

    uni-app的报错提示: 15:49:36.687 cid unmatched [object Object] at view.umd.min.js:1 15:49:36.708 TypeError ...

  2. Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must hav

    小程序报错 (Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects m ...

  3. 小程序生成二维码报错:40169:invalid length for scene, or the data is not json string

    生成二维码报错 scene的长度不合法 小程序参数scene 的长度最大32个可见字符 post提交的data不是json字符串

  4. Invalid attempt to spread non-iterable instance错误

    在项目中需要对数组进行合并运算的时候产生的错误 经查询一般是扩展运算符报错 错误中指明了文件和行数,去打印一下查看对应的数据 结果显示后面这一个需要合并的数组是undefined,所以数组合并运算就报 ...

  5. 【解决】TypeError: Invalid attempt to destructure non-iterable instance.In order to be iterable, non-a..

    [问题] 使用uniapp做APP,浏览器调试时没问题,真机调试时,HbuilderX控制台打印如下错误信息. [解决] 网上有各种答案,说明引起这种情况的原因有很多种,只说一下我遇到的. 我是在父组 ...

  6. uniapp android真机调试报错TypeError: Invalid attempt to destructure non-iterable instance

    上网查询之后发现是picker标签的原因.开始的代码 <u-cell-item title="仓库" :value="housetext" >< ...

  7. Missing Data in Kernel PCA

    目录 引 主要内容 关于缺失数据的导数 附录 极大似然估计 代码 Sanguinetti G, Lawrence N D. Missing data in kernel PCA[J]. europea ...

  8. 问题解决:枚举值插入数据库时报错 java.lang.IllegalArgumentException: invalid comparison: XXEnum and java.lang.String

    问题描述:出现了一个问题,将枚举类型的值插入数据库后,报出了下面这个错误 java.lang.RuntimeException: nested exception is org.apache.ibat ...

  9. 【论文笔记】ECCV_2016_The Unreasonable Effectiveness of Noisy Data for Fine-Grained Recognition

    文章目录 基础信息 Abstract 1 Introduction 2 Related Work 3 Noisy Fine-Grained Data 3.1 Categories 3.2 Images ...

  10. php rfc3986规范,「PSR 规范」PSR-7 HTTP 消息接口规范

    「PSR 规范」PSR-7 HTTP 消息接口规范 HTTP消息接口 此文档描述了 RFC 7230 和 RFC 7231 HTTP 消息传递的接口,还有 RFC 3986 里对 HTTP 消息的 U ...

最新文章

  1. 【FJOI2015】最小覆盖双圆问题
  2. matlab apfc,APFC-Boost 带APFC的Boost升压变换器在Matlab中的仿真实现 - 下载 - 搜珍网...
  3. 开发函数计算的正确姿势———为 PHP 运行时添加自定义扩展
  4. webassembly_WebAssembly的设计
  5. linux命令终极系列awk
  6. ssis 导入excel_使用SSIS包将MS Excel数据导入数据库
  7. 【sklearn第十七讲】特征选择
  8. WordPress直接调用头像地址
  9. 12V转3.3V稳压芯片7.4v转5V
  10. 互斥事件的概念和公式_独立事件与互斥事件的区别与联系公式
  11. java.net.ConnectException: no available server
  12. Oracle中TO_NUMBER()函数的用法
  13. 计算机系新春祝福语,春节的祝福语
  14. java导出eml_java 本地生成带附件的eml文件
  15. Partial Multi-Label Learning(PML)-文献学习
  16. pci-e服务器显卡性能,RTX 2080 Ti PCI-E性能测试:3.0 x16终于成为必需
  17. 项目提示JDK版本问题或者语言级别问题时的解决办法
  18. 2022.3.20 春分
  19. 统计学,机器学习,深度学习,数据挖掘的联系
  20. 一名程序员心态的重要性

热门文章

  1. Android之notificaction使用
  2. 全面分析网络安全防御
  3. opencv4 图像特征匹配_【从零学习OpenCV 4】图像模板匹配
  4. kali linux 2017 中文,Kali Linux 2017.3 发布,带来已升级的内核和新工具
  5. CSDN Markdown帮助文档
  6. java的lr词法编译器,自制编译器 青木峰郎 笔记 Ch3 词法分析的概要
  7. exists sql用法_《SQL进阶教程》笔记(3)
  8. 通过adb查看当前页面中显示的窗口Activity名称
  9. android 接口的调用方法参数类型转换,Android NDK开发之JNI基础
  10. 成熟的Richardson模型