C# Invalid attempt to call Read when reader is closed

后端 未结 2 1417
梦谈多话
梦谈多话 2020-12-29 06:10

I am having Invalid attempt to call Read when reader is closed error when I am doing 3 tier project in C# language. What I am trying to do is retrieve address data column by

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 06:23

    Previous one is a good example ... But you can also accomplish it by below code which is automatically close a connection instance when datareader.close() method called ...

    reader = Sqlcmd.ExecuteReader(CommandBehavior.CloseConnection); 
    

提交回复
热议问题