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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:12:30+00:00 2026-05-25T10:12:30+00:00

I am writing a Sql client in C#, and would like to be able

  • 0

I am writing a Sql client in C#, and would like to be able to track the data usage of Sql commands at a single point. From what I can tell, there is no simple way to do this.

My function to get the data back from the SqlCommand looks something like this:

private static void ExecuteReaderCallback(IAsyncResult async)
{
    DBReqWrapper RequestObject = (DBReqWrapper)async.AsyncState;
    SqlDataReader ResponseReader = command.EndExecuteReader(async);
    if (ResponseReader.HasRows)
    {
          while (ResponseReader.Read())
         {
              object[] NewResponse = new object[ResponseReader.FieldCount];
              ResponseReader.GetValues(NewResponse);

              // Processing omitted
         }
    }

    ResponseReader.Close();
}

What I don’t think will work:

  1. Serializing the data to find out the size. Too slow, especially for large requests.
  2. sizeof. We are dealing with objects of unknown type.
  3. Marshal.sizeof. We are dealing with managed objects.
  4. Checking the application total memory. This is a multi-threaded application that will have many concurrent requests being processed and memory totals will be unreliable.
  5. SqlDataReader::GetBytes(). This command is only valid for a subset of types.

Any help is appreciated, thanks!

  • 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-05-25T10:12:31+00:00Added an answer on May 25, 2026 at 10:12 am

    If you’re looking to count how much data is streamed across the ‘net, none of those will really work. SQL Server uses, as its application-level wire format, a protocol called TDS (Tabular Data Stream).

    I think that performance counters might be your friend here.

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

Sidebar

Related Questions

I'm writing SQL (for Oracle) like: INSERT INTO Schema1.tableA SELECT * FROM Schema2.tableA; where
I am writing a Silverlight client that interacts with an SQL database via ASP.NET
I am new to writing SQL and would greatly appreciate help on this problem.
I'm writing a system at the moment that needs to copy data from a
I'm writing an API for retrieving data from a JDBC-connected Java Servlet via JSON.
I am writing an SSIS package that has a conditional split from a SQL
I always have this notion that writing SQL queries in the code behind is
When writing manual SQL its pretty easy to estimate the size and shape of
I'm writing a SQL query in SQL Server in which I need to replace
I'm writing an SQL Query, where a few of the columns returned need to

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.