Ans
Posts: 53
|
Posted: 05/29/2006, 10:35 PM |
|
I can't seem to display boolean values in all the tables which have them.
Is there any known bug?
I tried setting various combination for the Format(1;0 or yes;no..)
but to no avail.
I set the data type to boolean. I am using jsp on MS SQL Server 2000
|
|
|
mrachow
Posts: 509
|
Posted: 05/30/2006, 12:00 AM |
|
Maybe you can try a Checkbox as control?
_________________
Best regards,
Michael |
|
|
Ans
Posts: 53
|
Posted: 06/05/2006, 2:20 AM |
|
Quote mrachow:
Maybe you can try a Checkbox as control?
I tried that but it still does not work!
MS SQL Server uses BIT instead of boolean. It can handle null values, but I am not using null. Is it configuration of the database in CCS? I set the boolean format to '1:0'.
Any help is REALLY appreciated.
|
|
|
Ans
Posts: 53
|
Posted: 06/05/2006, 6:59 PM |
|
I tried using TEXT as the data format(in CCS) for the 'bit' data type (in MS SQL Server 2000) and it works. The values are displayed as 'true' and 'false'
But I cannot add or edit. The error is below
Quote :[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Syntax error converting the nvarchar value 'true' to a column of data type bit.
Any ideas how to sovle this?
|
|
|
Ans
Posts: 53
|
Posted: 06/05/2006, 7:41 PM |
|
I am trying to work ard this problem by using a custom code. I have 2 controls, factoryName (text) and isValid (text in CCS, but bit in SQL Server)
I plan to use the BeforeExecuteInsert Event. I will check the 'text' isValid control from the record. If it is 'true', I will use 1 and if it is 'false', I will use 0.
JDBCConnection conn = JDBCConnectionFactory.getJDBCConnection("testDB");
long factory = Utils.convertToLong(e.getRecord().getControl("factoryName").getValue()).longValue();
if(("true".equals(e.getRecord().getControl("isValid").getValue())) || ("1".equals(e.getRecord().getControl("isValid").getValue())))
{
long isValid = Utils.convertToLong(1).longValue();
} else
{
long isValid = Utils.convertToLong(0).longValue();
}
String sql = "INSERT INTO factory VALUES "+
conn.toSql(String.valueOf(factory),JDBCConnection.TEXT)+
"," + conn.toSql(String.valueOf(isValid),JDBCConnection.BOOLEAN);
conn.executeUpdate(sql);
e.getCommand().setSql(sql);
But the code does not compile. I got the below error
Quote :C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\spc\database\factory_jsp.java:211: cannot resolve symbol
Tried using some printout debugging statements...but nothing is printed out.
Ok...can you sense my desperation?
|
|
|
Ans
Posts: 53
|
Posted: 06/07/2006, 1:56 AM |
|
I finally got it working. But the solution is a little weird.
MS SQL Server 2000 data type 'bit' is actually Integer value of 1 or 0 (null is allowed).
Here is the weird part. To get it to work in CCS, you got to set your server setting's Boolean Format to 'true;false'. And for your grid, control etc, the value to the database must be set as 'true' and 'false'. Default or 1/0 does not work.
Not too sure why there is this contradiction....but hey...IT WORKS!!!!
|
|
|
Christopher
|
Posted: 08/09/2006, 7:45 PM |
|
Hey, can you help me guys? I had this SQLException in database.. btw, our middle tier uses c#..
"Syntax error converting the nvarchar value 'true' to a column of data type bit."
|
|
|