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 8724731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:53:27+00:00 2026-06-13T07:53:27+00:00

In C# .NET 4.0 have a BlockingCollection that is taken from BlockingCollection Sample BC_AddTakeCompleteAdding

  • 0

In C# .NET 4.0 have a BlockingCollection that is taken from

BlockingCollection

Sample BC_AddTakeCompleteAdding

My problem is that a SQLCommand.ExecuteNonQuery in .NET is returning the wrong row count.
The update is on the primary key so should get one row.
Some times get the correct number.
Often getting a number greater than 1 (100-10000) in .NET.
And it is not always the same wrong number even when running the exact same TSQL against the same PK.
Can copy paste the TSQL to SSMS and get the correct answer (1) every time.

update [docSVsys]  set [FTSstatus] = '1', [FTSdate] = '10/23/2012 8:51:32 AM' , 
textHash = '5b4d553360fbe733a66eebf36fa666f7', [textSize] = '39504' 
where [sID] = '1525850'

Declaring the variable on use and no other variable is named rowsRet5

int rowsRet5 = sqlCmdUpate.ExecuteNonQuery();

Checked for that textHash value and only the one row was updated.
It appears to perform the proper update but reports the wrong count.
Given the count is wrong not willing to use this on production data.

This command is at the end of the consumer side.
Have two .BeginExecuteNonQuery above this update.
Those updates are to different tables and do not reference docSVsys.
Those tables do have FK reference to docSVsys.
In debug if I stop in callbacks (slow it down) then I don’t get this error.
I am wondering if BeginExecuteNonQuery in a Task is not the problem.
This wrong rowCount does not match either of asynch rowCounts but is in the same range.

This base code has processed millions of rows.
Did not change any of the TSQL.
It went bad when converted to producer consumer.

To mark a document as in progress use a very similar TSQL in the producer side and it has no problems. That loop also has a BeginExecuteNonQuery.

  • 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-13T07:53:28+00:00Added an answer on June 13, 2026 at 7:53 am

    The problem appears to be sharing a connection and command on both the producer and consumer side.

    Yes I realize that is obviously a bad thing to do.
    When it was a single loop (no producer consumer sides) it was OK to share that command.
    When I converted to consumer producer I did not think to split the command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does .NET have some type of built in function that allows filtering on Gridviews?
I have .NET application that is hosted on IIS 6.1 It is impossible to
I have .Net service that listens on single port over TCP protocol. Clients connect
I have application in VB.net that have two different form (Form1 and Form2). Now
I have .NET application that crashes with NullReferenceException. The funny thing is that the
Does asp.net have a built in mechanism that can sanitize all textbox input instead
Does Spring.NET have any support (integration) with NHibernate that would eneble per request ISession
Posters at Are EventArg classes needed now that we have generics and Does .NET
I have .Net client that sends files. How can i use PHP web service
I am using a .NET 4.0 BlockingCollection to handle a queue of items that

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.