Showing posts with label API. Show all posts
Showing posts with label API. Show all posts

Friday, June 07, 2019

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

This can happen if you execute a query while iterating over the results from another query. I ran into this issue when I called another async call while I was executing one result.

public async Task<IActionResult> GetTicketsInventory(int customerID, int accountID)
        {
            var service_response = await this.ticketsService.GetTicketsInventory(customerID, accountID);
            List<TicketsInventoryCO> items = service_response.Response.ToConvert();

               // this is my second call where i am trying to get results based on some condition
               // to get customer names
                var customer_response = await this.customerService.GetAllMobilityCustomers();

            return ProcessServiceResponse(
                apiContext,
                service_response,
                items,
                null);

        }

This can be easily solved by allowing MARS in your connection string. Add MultipleActiveResultSets=true to the provider part of your connection string (where Data Source, Initial Catalog, etc. are specified). Sample connection string

 "CoreCS": "Data Source=xxx.xxx.xxx.xxx;Initial Catalog=Mobility;Integrated Security=False;User Id=sa; Password=xxxxxx;Max Pool Size=20; Connection Timeout=10;MultipleActiveResultSets=true;",

Wednesday, December 22, 2010

Facebook.NET

Facebook.NET provides a .net library for use in developing Facebook applications and accessing Facebook APIs. The library primarily geared around and optimized for developing ASP.NET-based Web applications, both FBML and IFrame-based Facebook applications through an intuitive API and small set of server controls. It does support the use of the Facebook API from desktop applications as well, and will eventually enable Silverlight application usage.
The library is built on .NET 2.0, but should run on future versions of the .NET framework as well. Applications using Facebook.NET can be written in either C# or VB.NET.

Download from here