Invalid attempt to call FieldCount when reader is closed

后端 未结 5 596
长发绾君心
长发绾君心 2020-12-20 03:45

The error above occurs when I try to do a dataReader.Read on the data recieved from the database. I know there are two rows in there so it isnt because no data actually exis

5条回答
  •  醉梦人生
    2020-12-20 04:09

    When you use the Using in C#, after the last } from the using, the Connection automatically close, thats why you get the fieldcount to be closed when u try to read him, as that is impossible, because u want those datas, read then before close the using, or u can open and close manually the connection, by not using the (using)

提交回复
热议问题