Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8203731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:39:39+00:00 2026-06-07T07:39:39+00:00

I am adding Items in Queue<string> Asynchronously to Queue.Instead of Inserting row by row

  • 0

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);

        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:39:41+00:00Added an answer on June 7, 2026 at 7:39 am

    Yes it is possible and you can do this by adding some code to your AddItemsToQueue(string itm) method.

    public static void AddItemsToQueue(string itm)
        {
            evtLogQueue.Enqueue(itm);
            // Add the following code
            if (evtLogQueue.Count == 1000)
            {
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add("Log");
                foreach (var log in evtLogQueue)
                { 
                    DataRow dr = dataTable.NewRow();
                    dr["Log"] = log;
                    dataTable.Rows.Add(dr);
                }
                evtLogQueue.Clear();     // Most probably you will also need to clear the queue.
                SendBulkData(dataTable); // Send the bulk data
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When adding items using the default insert method Insert(key, value) and as such using
As a simple example, I'm adding 5 items to a new RabbitMQ(v 2.6.1) queue:
I'm adding a series of buttons to a UINavigationBar using: NSArray *items; items =
Now I can add items with store.newItem() . After adding it, it's placing it
After adding <item>170,000</items> to string.xml . It becomes so slow in building workspace, I
I have a WPF application that uses MVVM data bindings. I am adding items
I'm adding items to a jquery mobile listview problematically. I'm currently using jquery templates
I am using ZedGraph to create a pie chart, and adding items to it
I'm adding items dynamically when a row is selected from GridView. 1. How can
I have comboBox component and i am adding items like comboBox1.Items.Add(Item1) . But i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.