• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfgrid

Guest
Aug 15, 2006 Aug 15, 2006

Copy link to clipboard

Copied

Im usin the cfgrid to show database content.
But when it get eather 0 or 1 from a bit row in the database it shows false or true.

Is there a way to make it show the data as it is shown in the database eg. 0 and 1???

The problem is when adding a new row i use the existing rows as a template.
And writing false or true instead of 0 or 1 makes the code crash.
TOPICS
Advanced techniques

Views

434

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Aug 16, 2006 Aug 16, 2006
Thanks, that is a good solution.

But I did something else.
I thought a little about it and i think that true and false sayes more than 1 and 0.

Therefore I desided to keep that. Insted I did the following.

When I'm about to save the data I use sp_columns to get the Type_Name from the table.
If the Type_Name is bit I convert the true/false to 1/0

Votes

Translate

Translate
Mentor ,
Aug 15, 2006 Aug 15, 2006

Copy link to clipboard

Copied

Which database, and what is the datatype of the column?

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 15, 2006 Aug 15, 2006

Copy link to clipboard

Copied

The database used is MS SQL 2000
and the datatype is bit

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

Within your query, just CAST() your bit field to int, and it will display its integer value in CFGRID.

SELECT CAST(your_bit_col AS int) AS new_col_name,
your_bit_col
FROM your_table

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

LATEST
Thanks, that is a good solution.

But I did something else.
I thought a little about it and i think that true and false sayes more than 1 and 0.

Therefore I desided to keep that. Insted I did the following.

When I'm about to save the data I use sp_columns to get the Type_Name from the table.
If the Type_Name is bit I convert the true/false to 1/0

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation