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

  • Home
  • SEARCH
  • 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 8898203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:33:13+00:00 2026-06-15T00:33:13+00:00

I have a small console application written on C# .NET 2.0. The application queries

  • 0

I have a small console application written on C# .NET 2.0.
The application queries a database and takes a certain amount of id numbers, by which it then addresses a web service and get some “statuses” according to the id numbers.
Then the statuses are written back to the database.
Trough out the whole process I keep an open connection to the database, which I’m not sure to be the best way for batch processing as long as the application blocks the database engine and other clients are unable to work properly.
Opening and closing a connection for each operation does not seem wise as well.

What would be considered as the best way to handle those batch processes?

  • 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-15T00:33:15+00:00Added an answer on June 15, 2026 at 12:33 am

    If you have loads of ids and want to update them all in a one go (a batch), you can form two CSV strings and pass them as parameters to a stored procedure(sp).

    Also you need a function to split (Here are a few) those CSVs inside the sp and then update your table.

    Ex;

    //Make sure you have a relation between id and statusid here. i.e. same index
    string csvIds = "101,2234,349,..."; //CSV for ids
    string csvStatusIds = ="1,2,3,..."; //CSV for statusIds
    
    //Pass above csv lists to the following stored procedure...
    
    //Create a stored procedure to pass above ids.    
    CREATE PROCEDURE [dbo].[updateStatuses] 
    
        @Ids VARCHAR(Max),
        @StatusIds VARCHAR(Max)
    
    AS
    BEGIN
         DECLARE @tblIds TABLE (key1 INT IDENTITY(1,1), myId INT)
         DECLARE @tblStatusIds TABLE (key2 INT IDENTITY(1,1), myStatusId INT)
    
         INSERT INTO @tblIds
            SELECT ITEMS FROM dbo.Split(@Ids,',')
         INSERT INTO @tblStatusIds
            SELECT ITEMS FROM dbo.Split(@StatusIds,',')
    
         --//Do your status update here
         UPDATE yt.statusId = s.myStatusId
         FROM [YourTable] yt JOIN @tblIds i 
                    ON yt.id = i.myId JOIN @tblStatusIds s
                    ON i.key1 = s.key2
    
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written up a small console utility. Throughout the application, I have used slf4j/log4j
I have a small application written in c# as a console app that I
I have a small Win32 console application which is essentially a test harness. I
I have written small C++ console application and this is source code : #include<stdio.h>
i have a small console application which connects to outlook with using com. My
I have created a small chatting application in C#, and started as a Console
I have small database of business and their addresses. Using the Google Geocode API
I have a small console app containing a web server written in c#. When
I have written a small Python application where I use PyGame for displaying some
I have a small console application, that asks for a values to count with

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.