There is already an open DataReader associated with this Command which must be closed first

前端 未结 18 2321
孤街浪徒
孤街浪徒 2020-11-22 01:40

I have this query and I get the error in this function:

var accounts = from account in context.Accounts
               from guranteer in account.Gurantors
           


        
18条回答
  •  -上瘾入骨i
    2020-11-22 02:09

    I am using web service in my tool, where those service fetch the stored procedure. while more number of client tool fetches the web service, this problem arises. I have fixed by specifying the Synchronized attribute for those function fetches the stored procedure. now it is working fine, the error never showed up in my tool.

     [MethodImpl(MethodImplOptions.Synchronized)]
     public static List MyDBFunction(string parameter1)
      {
      }
    

    This attribute allows to process one request at a time. so this solves the Issue.

提交回复
热议问题