Hi there,
I am using MS SQL Server 2000 with DbForms 1.1.3. I have a few boolean
fields in my database, which are meant to be represented by the java SQL BIT
type. However, DbForms appears not to have support for BIT yet. The behavior
of these BIT fields is strange enough so I can't implement them with the
current checkboxes myself. Say I have a <db:checkbox value="1" novalue="0"
fieldName="booleanField"/> - the values in the database won't feed the
checkbox. By using a db:label I determined that the value my JDBC driver
delivers for "1" in the database ends up being "true" whereas the
"unchecked" value, "0" will be delivered as "false". However, when I want to
enter data into the database I have to send "1" or "0" rather than those
strings, otherwise I will get a JDBC error from the driver. I think BIT can be represented if db:checkbox gets two new attributes,
"sendvalue" and "sendnovalue". F.i. <db:checkbox value="true" sendvalue="1" "novalue="false"
sendnovalue="0" fieldName="booleanField"/>
Reading data works like before for db:checkbox, but rendering inserts the
value of "sendvalue" and "sendnovalue" instead. I am not sure if this will
help anybody else because I can't test if any other databases/drivers have a
similar behavior. I also didn't get to test this much (it definitely works
for me, with a single checkbox), but I submit it anyway in the hopes that
somebody might find it useful. I have added the new attributes for the
checkbox tag in taglib_docu.xml plus a diff against
I think that the best way to do this is to add a new dbform's type BOOLEAN, which map to boolean and use PreparedStatement.setBoolean to write and getBoolean to read from jdbc layer, in this way I presume the output will remain coerent with input. But if you have mapped it to a string, you can try to use an int type, maybe the jdbc driver is able to convert it correctly.
cheers, Sergio Moretti
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ DbForms Mailing List
http://www.wap-force.net/dbforms
