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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:44:59+00:00 2026-05-16T21:44:59+00:00

I’ve inherited a piece of code at work and I’ve just noticed a fairly

  • 0

I’ve inherited a piece of code at work and I’ve just noticed a fairly trivial but bizarre little quirk with it. So maybe someone can save me setting up clean .NET 2.0 Environment to test it out.

There is a SQL2K5 table containing a column called IsEnabled BIT NOT NULL

There is a sproc selecting from that table

There is a piece of C# code which, using a SQL Reader calls that SPROC, loops through the result rows, and writes some of that info to a log file as well as doing other things.

using (SqlDataReader reader = DAL.SqlHelper.ExecuteReader(connStr, "usp_MySproc"))
{
    while (reader.Read())
    {
         //code to do stuff...

         string s = reader["IsEnabled "].ToString(); //exactly like this...

         //code to concatenate `s` with other values
         //log it all to file
    }
}

The odd thing is, in some older log files, that value is written out as a 1 or a 0 whereas in newer logfiles it’s written out as a true or a false

So one of the following things has happened. It was caused by:

  1. Someone changing the code
  2. Someone changing the datatype in the table from int -> bit
  3. Someone changing the datatype in the sproc from int -> bit (maybe there was a cast/convert in there that got removed)
  4. an installation of .NET 3.5 across all of our production servers a few months ago, and the dates do seem to coincide with the change in the log files,

I’ve trawled google for that last hour or so looking for changes between .net 2.0 & .net 3.5 but nothings jumping out at me.

Can anyone shed any light on this ?

  • 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-16T21:45:00+00:00Added an answer on May 16, 2026 at 9:45 pm

    You could rebuild your code for .NET 2.0 and run a test to see if the code base you have now outputs 1/0 or true/false. That should provide you your answer. Also, it’s not really boolean.ToString() that you’re calling in this case. It is the data reader, using the default collection and casting. It may be that datareader changed how it outputs bit fields when to string is called on them.

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

Sidebar

Related Questions

No related questions found

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.