I am adding Items in Queue”<“string”>” Asynchronously to Queue.Instead of Inserting row by row for each data of Queue using INSERT query, I want to add these items to DataTableOnly when if(evtLogQueue.Count==1000). So that the DataTable could be used further for Bulk Insert using BulkCopy to SQLServerDB.
I would like to know is it Possible to do? if YES then how? or any other suggestion?
Sample Code:
static Queue<string> evtLogQueue = new Queue<string>();
public static void AddItemsToQueue(string itm)
{
evtLogQueue.Enqueue(itm);
Console.WriteLine("Length of Queue:" + evtLogQueue.Count);
}
Yes it is possible and you can do this by adding some code to your
AddItemsToQueue(string itm)method.