Already Data Reader Open

Results 1 to 2 of 2

Thread: Already Data Reader Open

  1. #1
    Join Date
    Dec 1969

    Default Already Data Reader Open

    I am trying to write an if then else statement using ASP.NET, but I get an error that there is already a data reader open, although I have clearly closed it before trying to executre the non-query. What would be the correct way to write this?<BR><BR>with myCommand2<BR>myDataReader2 = myCommand2.ExecuteReader()<BR><BR>if not (myDataReader2.Read())<BR>response.write ("BOOTS")<BR>myDataReader2.Close()<BR><BR>else<BR> myCommand.ExecuteNonQuery()<BR><BR>end if<BR>end with<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Already Data Reader Open

    Try putting the myDataReader2.Close() in the Else block with the ExecuteNonQuery() command.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts