c# - How to perform an ExecuteScalarAsync on several queries and manipulate data -
I am using ADO.NET and returning the boolean value to me in one of the ways Is required if any customer is using any product of the company, due to this reason I need to execute many questions because different products have separate compartments with different clients, so I terminate it: / P>
SqlCommand firstProduct = new SqlCommand (firstQuery, connection); First product. Comma timeout = 300; IAsyncResult Number of Used Products = FirstProject Exclsar sarsink (); // second product SqlCommand secondProduct = new SqlCommand (secondQuery, connection); SecondProduct.CommandTimeout = 300; IAsyncResult Number of Used Products 1 = Second Product. XXSLLSINNCNC (); // Third rpoduct SqlCommand third product = new SqlCommand (third query, connection); Third product Comma timeout = 300; IAsyncResult numberOfUsedProducts2 = thirdProduct .ExecuteScalarAsync (); What exactly do I want to know about how to proceed and gather results from each query, so can I execute some extra arguments?
By my investigation I saw that I can use something like this:
Ruchandal waiting zone 1 = FirstPropic Asynchronoushandle; Waiting Waiting Wonders 2 = Second Product Asynchronoushandle; Waiting room wait 3 = third product. Asynchronoushandle; System.Threading.WaitHandle [] Waiting Handles = {Waiting Handle 1, Waiting Handle 2, Waiting Handle 3}; and then
index = wait gang. Wait (waithandle, 60000, wrong); Switch (index) {.. But honestly I'm not sure what the above code is doing. What I need is to handle two scenarios - collect results from all the three questions and Check it out. And if possible, since I think that what I have read, it seems like this, at the moment, any question is different from zero, because sometimes I care only if the customer is using any product Whether or not, and not how much of each prodcuts
Your use of IAsyncResult is obsolete ExecuteScalarAsync Returns a task (which implements IAsyncResult , but it does not explicitly use it anymore).
The next problem is that you are using the same connection that is not allowed.
Your code should probably look like this:
var results = awaiting action. When all (first product, ...);
If you want to stop any returns as soon as possible, then Tasks. When using any and use cancellation token Infrastructure.
Comments
Post a Comment