craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > JDBC/Database Issues Post New Topic   Post A Reply
checkbox dont update if first row begin printer friendly version
next newest post | next oldest post
Author Messages
infow
Unregistered
Edit or delete this message Reply w/Quote
Posted Wednesday, October 24, 2007 @ 10:56:19  

Hi, i have a table (oracle) with a checkbox
CREATE TABLE atest (
id VARCHAR2(9) NOT NULL,
checkbox VARCHAR2(1) NOT NULL
)
insert into atest(id,checkbox) values('1','O');
insert into atest(id,checkbox) values('2','O');
insert into atest(id,checkbox) values('3','O');

if you want to deselect all checkbox BEGINNING with the first line, then the second checkbox will not be "deselected" after a refresh.
i have at the beginning:
1 O
2 O
3 O

with my mouse i put all checkbox out (beginning with first line), i have
1 N
2 N
3 N
but when i refresh i have
1 N
2 O
3 N

a bug ...

here's the code to try:

import java.awt.*;
import java.awt.event.*;
import java.sql.SQLException;
import java.util.Hashtable;

import javax.swing.*;
import javax.swing.table.*;

import quick.dbtable.Column;

public class Main extends JFrame
{
public Main()
{

setSize(300,200);
setVisible(true);
quick.dbtable.DBTable dBTable1 = new quick.dbtable.DBTable();
getContentPane().add(dBTable1);
dBTable1.setDatabaseDriver("oracle.jdbc.driver.OracleDriver");
dBTable1.setJdbcUrl("jdbc:oracle:thin:demo/mypass@127.0.0.1:1521:ORCL");
dBTable1.setSelectSql("select id,checkbox from atest");
dBTable1.addUpdateSql("update atest set checkbox =? where id =?", "2,1");
dBTable1.addInsertSql("insert into atest ( id, checkbox) values (?,?)", "1,2");
dBTable1.addDeleteSql("delete from atest where id = ?", "1");
dBTable1.createControlPanel();
try
{
dBTable1.connectDatabase();
dBTable1.refresh();
Column colonne = dBTable1.getColumn(1);
colonne.setPreferredWidth(50);
Hashtable h = new Hashtable();
h.put("O", new Boolean(true));
h.put("N", new Boolean(false));
dBTable1.setCellComponent(colonne, Column.CHECKBOX_CELL, h);
dBTable1.refresh();
}
catch(SQLException e)
{
e.printStackTrace();
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}

}

public static void main(String[] args)
{
Main myframe = new Main();
}
}

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Wednesday, October 24, 2007 @ 12:59:37  

Did you enable debug and check the logs?

May be it is a typo, you are calling refresh twice in your code.

infow
Unregistered
Edit or delete this message Reply w/Quote
Posted Thursday, October 25, 2007 @ 02:45:20  

it's a bug ... the debug says that he doesn't update the second line !

Primary Column: 0
Executing row count sql=SELECT COUNT(*) from atest
Time taken to execute rowcount sql=67ms
Time taken to execute select sql=6ms
Database meta data information received from jdbc driver
Column 1: Name: ID
ReadOnly: false
Data Type: VARCHAR
Length: 9

Column 2: Name: CHECKBOX
ReadOnly: false
Data Type: VARCHAR
Length: 1

Data updated (0,1): oldvalue: N new value: O
Data updated (1,1): oldvalue: N new value: O
Executing sql update atest set checkbox =? where id =? with arguments:
Argument 1: Datatype in database:VARCHAR. Datatype of cell data: java.lang.String. Value:O
Argument 2: Datatype in database:VARCHAR. Datatype of cell data: java.lang.String. Value:1
oldvalue: O new value: O are same. So this will not be updated to database
Data updated (2,1): oldvalue: N new value: O
Executing sql update atest set checkbox =? where id =? with arguments:
Argument 1: Datatype in database:VARCHAR. Datatype of cell data: java.lang.String. Value:O
Argument 2: Datatype in database:VARCHAR. Datatype of cell data: java.lang.String. Value:3

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Thursday, October 25, 2007 @ 22:15:27  

Please use the latest version from today, this problem is resolved
Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios