Board index » delphi » DBCheckbox Gray out after post. (Urgent)

DBCheckbox Gray out after post. (Urgent)

I am using MS SqlServer 2000/Delphi 6/Win2000 SBS.
I am using DBCheckbox to show a field IsMember(char 10) in a table. I set ValueChecked as YES and ValueUnchecked as NO. I have also set AllowGrayed as false.

The problem is the DBCheckbox grays after saving the record. It saves the value YES or NO alright in the database but always look grayed.

What I am doing wrong?

Emmanuel

 

Re:DBCheckbox Gray out after post. (Urgent)


When the value in the underlying dataset field is not equal to the
ValueChecked nor the ValueUnchecked value the checkbox will go gray, even
when AllowGrayed = False.

First I would verify that the "YES" and "NO" values are correctly stored in
the database. If not, track down why. Perhaps the problem is related to
trailing spaces in the database that are not in the ValueChecked values
(since you are using char rather than varchar).

If they are stored correctly, then look at our code to see if it is possible
that you are positioning to a different record after the POST, one that
doesn't have "YES" or "NO" in the field.

Kevin

Quote
"Emmanuel" <i...@beama.org.uk> wrote in message

news:3ef1a787$1@newsgroups.borland.com...
Quote

> I am using MS SqlServer 2000/Delphi 6/Win2000 SBS.
> I am using DBCheckbox to show a field IsMember(char 10) in a table. I set

ValueChecked as YES and ValueUnchecked as NO. I have also set AllowGrayed as
false.
Quote

> The problem is the DBCheckbox grays after saving the record. It saves the

value YES or NO alright in the database but always look grayed.
Quote

> What I am doing wrong?

> Emmanuel

Re:DBCheckbox Gray out after post. (Urgent)


Instead of setting your values to YES & No, rather set them to TRUE & False.

Quote
"Emmanuel" <i...@beama.org.uk> wrote in message

news:3ef1a787$1@newsgroups.borland.com...
Quote

> I am using MS SqlServer 2000/Delphi 6/Win2000 SBS.
> I am using DBCheckbox to show a field IsMember(char 10) in a table. I set

ValueChecked as YES and ValueUnchecked as NO. I have also set AllowGrayed as
false.
Quote

> The problem is the DBCheckbox grays after saving the record. It saves the

value YES or NO alright in the database but always look grayed.
Quote

> What I am doing wrong?

> Emmanuel

Re:DBCheckbox Gray out after post. (Urgent)


Whether you use "YES" or "NO" or "TRUE" or "FALSE", your field's value  will
be different than those values. Since you defined your field as char, SQL
server will pad it with trailing blanks. Your "YES" will become "YES       "
(y, e, s and 7 trailing blanks.
To solve the problem easiest way, change your field to varchar or use TRIM
if you prefer server side solution

Best Regards
Celal ERGUN

Quote
"Emmanuel" <i...@beama.org.uk> wrote in message

news:3ef1a787$1@newsgroups.borland.com...
Quote

> I am using MS SqlServer 2000/Delphi 6/Win2000 SBS.
> I am using DBCheckbox to show a field IsMember(char 10) in a table. I set

ValueChecked as YES and ValueUnchecked as NO. I have also set AllowGrayed as
false.
Quote

> The problem is the DBCheckbox grays after saving the record. It saves the

value YES or NO alright in the database but always look grayed.
Quote

> What I am doing wrong?

> Emmanuel

Other Threads