Brian Watts
|
| Posted: 06/13/2002, 4:45 PM |
|
All of a sudden, checkboxes are not being filled in correctly from the database.
For example, a Boolean checked field in an Access database, when viewed in
a form is *unchecked*. The form still updates correctly and the value can be verified
by looking at the raw data. What's more, this only happens with ASP -- when
I switch to PHP, the checkboxes appear correctly. It looks like some of the
common code has gotten corrupted....
Also, and I don't know if this is related, lines of code got removed from
the page.asp file causing the updates and inserts to fail. The two subroutines affected were the Insert and the Update Method subroutines. In both cases, the
line assigning data to Cmd.SQL got deleted. I manually reconstructed these lines after the fact in order to get the inserts and updates to work again..!
Any ideas CodeCharge team?
Brian Watts
|
|
|
 |
Brian Watts
|
| Posted: 06/13/2002, 4:50 PM |
|
Sorry -- I forgot to mentioned this happened using CCS 1.0.6.0
BW
|
|
|
 |
Jeff Turkington
|
| Posted: 06/13/2002, 4:57 PM |
|
The same thing has happened to be since B3 days... and I have long abandoned using the boolean type. I have only tested this in an ASP/SQL 2000 environment, but my solution is to make the contol INTEGER, and use -1 for checked, and 0 for un-checked.
Hope that helps,
Jeff
|
|
|
 |
Brian Watts
|
| Posted: 06/13/2002, 7:23 PM |
|
Thanks for the tip Jeff.
I'm still very curious as to what is going on though... it is
disconcerting to think that CCS is devouring itself - to say the
least.
Brian
|
|
|
 |
Robert Rodgers
|
| Posted: 06/13/2002, 7:29 PM |
|
For the boolean field it is probably how the value of the field is returned from the recordset. The Value from the recordsset is returned as "True" or "False", If you are like me and used a boolean or bit (in mssql) you were probably expecting a "0" for false, and anything else for true (vb true is "-1", other languages use "1"). Anyway, in the properties for the field if you enter "True" for "Checked Value" and "False" for "Unchecked Value" then the check box displays properly on the edit form, becuase when CCS does it's comparison "True" = "True" ("True" <> "1"). This is for ASP only, Other languages may handle the field values differently.
Rob
|
|
|
 |
Jeff Turkington
|
| Posted: 06/16/2002, 2:14 PM |
|
Hi Roger,
Tried that in my effort to sove this and upon seeing your post I tried it again. Error is below, any clues?
>>Error description: Syntax error converting the varchar value 'TRUE' to a >>column of data type bit. (Microsoft OLE DB Provider for SQL Server)
Jeff
|
|
|
 |
Nicole
|
| Posted: 06/18/2002, 2:27 AM |
|
Hello,
if you're using CCS1.0 please try the following solutions for ASP:
1. Access db.
Define following settings for checkbox field:
Data Type: Boolean
Checked Value: true
Unchecked Value: false
2. SQL Server.
Define following settings for checkbox field:
Data Type: Boolean
Checked Value: 1
Unchecked Value: 0
then open generated code, namely Sub Class_Initialize() of clsRecord<form_name> class (in ASP) and find lines:
<field_name>.CheckedValue = 1
<field_name>.UncheckedValue = 0
replace then with:
<field_name>.CheckedValue = 1
<field_name>.UncheckedValue = 0
Also it'd be helpful to refer to following discussion thread: http://www.gotocode.com/disc_viewt.asp?mid=11331
|
|
|
 |
|