当前位置: 技术问答>java相关
jdbTable漏洞
来源: 互联网 发布时间:2015-04-07
本文导语: 本人设计一个管理程序,在某个窗口上是这样设计的:窗口左边是一列按钮,中间是jdbTable,上边是工具条,下边是状态栏。左边的一列按钮用来控制jdbTable显示的内容。比如其中二个按钮 jButton_rule按钮 void jButton_...
本人设计一个管理程序,在某个窗口上是这样设计的:窗口左边是一列按钮,中间是jdbTable,上边是工具条,下边是状态栏。左边的一列按钮用来控制jdbTable显示的内容。比如其中二个按钮
jButton_rule按钮
void jButton_rule_actionPerformed(ActionEvent e) {
Column column1 = new Column();
Column column2 = new Column();
Column column3 = new Column();
Column column4 = new Column();
Column column5 = new Column();
//set the sql statement
queryDataSet_datashow.close();
queryDataSet_data_lookup.close();
queryDataSet_datashow.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select id as 序号,rule_name as 规则名称,rule_type as 规则类别 from tab_rule", null, true, Load.ALL));
queryDataSet_data_lookup.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select id,rule_type as 规则类别 from tab_rule_type", null, true, Load.ALL));
//define columns
column1.setColumnName("序号");
column1.setDataType(com.borland.dx.dataset.Variant.INT);
column1.setEditable(true);
column1.setRowId(true);
column1.setPrecision(10);
column1.setTableName("tab_rule");
column1.setServerColumnName("id");
column1.setSqlType(4);
column1.setVisible(com.borland.jb.util.TriStateProperty.FALSE);
column2.setColumnName("规则名称");
column2.setDataType(com.borland.dx.dataset.Variant.STRING);
column2.setDefault("");
column2.setPrecision(10);
column2.setTableName("tab_rule");
column2.setServerColumnName("rule_name");
column2.setSqlType(12);
column3.setColumnName("规则类别");
column3.setDataType(com.borland.dx.dataset.Variant.INT);
column3.setPrecision(10);
column3.setEditable(true);
column3.setPickList(new com.borland.dx.dataset.PickListDescriptor(queryDataSet_data_lookup, new String[] {"id"}, new String[] {"规则类别"}, new String[] {"规则类别"},"规则类别",false));
column3.setTableName("tab_rule");
column3.setServerColumnName("rule_type");
column3.setSqlType(4);
column4.setColumnName("type_id");
column4.setDataType(com.borland.dx.dataset.Variant.INT);
column4.setTableName("tab_rule_type");
column4.setServerColumnName("id");
column4.setSqlType(4);
column5.setColumnName("规则类别");
column5.setDataType(com.borland.dx.dataset.Variant.STRING);
column5.setTableName("tab_rule_type");
column5.setServerColumnName("rule_type");
column5.setSqlType(12);
queryDataSet_data_lookup.close();
queryDataSet_data_lookup.setColumns(new Column[] {column4,column5});
queryDataSet_data_lookup.open();
queryDataSet_datashow.close();
queryDataSet_datashow.setColumns(new Column[] {column1,column2,column3});
queryDataSet_datashow.open();
jdbTable1.setDataSet(queryDataSet_datashow);
}
jButton_user按钮
void jButton_user_mouseClicked(MouseEvent e) {
Column column1 = new Column();
Column column2 = new Column();
Column column3 = new Column();
Column column4 = new Column();
Column column5 = new Column();
Column column6 = new Column();
//set the sql statement
queryDataSet_datashow.close();
queryDataSet_data_lookup.close();
queryDataSet_datashow.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select id as 序号,user_name as 用户名,user_class as 用户类别 from tab_user", null, true, Load.ALL));
queryDataSet_data_lookup.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select id,class_name as 用户类别 from tab_user_class", null, true, Load.ALL));
//define columns
column1.setColumnName("序号");
column1.setDataType(com.borland.dx.dataset.Variant.INT);
column1.setEditable(true);
column1.setRowId(true);
column1.setPrecision(10);
column1.setTableName("tab_user");
column1.setServerColumnName("id");
column1.setSqlType(4);
column1.setVisible(com.borland.jb.util.TriStateProperty.FALSE);
column2.setColumnName("用户名");
column2.setDataType(com.borland.dx.dataset.Variant.STRING);
column2.setDefault("");
column2.setPrecision(10);
column2.setTableName("tab_user");
column2.setServerColumnName("user_name");
column2.setSqlType(12);
column3.setColumnName("用户类别");
column3.setDataType(com.borland.dx.dataset.Variant.INT);
column3.setPrecision(10);
column3.setEditable(true);
column3.setPickList(new com.borland.dx.dataset.PickListDescriptor(queryDataSet_data_lookup, new String[] {"id"}, new String[] {"用户类别"}, new String[] {"用户类别"},"用户类别",false));
column3.setTableName("tab_user");
column3.setServerColumnName("user_class");
column3.setSqlType(4);
column4.setColumnName("class_id");
column4.setDataType(com.borland.dx.dataset.Variant.INT);
column4.setTableName("tab_user_class");
column4.setServerColumnName("id");
column4.setSqlType(4);
column5.setColumnName("用户类别");
column5.setDataType(com.borland.dx.dataset.Variant.STRING);
column5.setTableName("tab_user_class");
column5.setServerColumnName("class_name");
column5.setSqlType(12);
queryDataSet_data_lookup.close();
queryDataSet_data_lookup.setColumns(new Column[] {column4,column5});
queryDataSet_data_lookup.open();
queryDataSet_datashow.close();
queryDataSet_datashow.setColumns(new Column[] {column1,column2,column3});
queryDataSet_datashow.open();
jdbTable1.setDataSet(queryDataSet_datashow);
}
问题:运行程序,点击jButton_rule按钮,从下拉列表中选择,正确;点击jButton_user按钮,从下拉列表中选择,出现以下错误提示:unknown column name:规则类别.按确定,再点击jButton_rule按钮,从下拉列表中选择,出现错误提示:unknown column name:用户类别.各位大侠,救命!!!!!!!!!!
jButton_rule按钮
void jButton_rule_actionPerformed(ActionEvent e) {
Column column1 = new Column();
Column column2 = new Column();
Column column3 = new Column();
Column column4 = new Column();
Column column5 = new Column();
//set the sql statement
queryDataSet_datashow.close();
queryDataSet_data_lookup.close();
queryDataSet_datashow.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select id as 序号,rule_name as 规则名称,rule_type as 规则类别 from tab_rule", null, true, Load.ALL));
queryDataSet_data_lookup.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select id,rule_type as 规则类别 from tab_rule_type", null, true, Load.ALL));
//define columns
column1.setColumnName("序号");
column1.setDataType(com.borland.dx.dataset.Variant.INT);
column1.setEditable(true);
column1.setRowId(true);
column1.setPrecision(10);
column1.setTableName("tab_rule");
column1.setServerColumnName("id");
column1.setSqlType(4);
column1.setVisible(com.borland.jb.util.TriStateProperty.FALSE);
column2.setColumnName("规则名称");
column2.setDataType(com.borland.dx.dataset.Variant.STRING);
column2.setDefault("");
column2.setPrecision(10);
column2.setTableName("tab_rule");
column2.setServerColumnName("rule_name");
column2.setSqlType(12);
column3.setColumnName("规则类别");
column3.setDataType(com.borland.dx.dataset.Variant.INT);
column3.setPrecision(10);
column3.setEditable(true);
column3.setPickList(new com.borland.dx.dataset.PickListDescriptor(queryDataSet_data_lookup, new String[] {"id"}, new String[] {"规则类别"}, new String[] {"规则类别"},"规则类别",false));
column3.setTableName("tab_rule");
column3.setServerColumnName("rule_type");
column3.setSqlType(4);
column4.setColumnName("type_id");
column4.setDataType(com.borland.dx.dataset.Variant.INT);
column4.setTableName("tab_rule_type");
column4.setServerColumnName("id");
column4.setSqlType(4);
column5.setColumnName("规则类别");
column5.setDataType(com.borland.dx.dataset.Variant.STRING);
column5.setTableName("tab_rule_type");
column5.setServerColumnName("rule_type");
column5.setSqlType(12);
queryDataSet_data_lookup.close();
queryDataSet_data_lookup.setColumns(new Column[] {column4,column5});
queryDataSet_data_lookup.open();
queryDataSet_datashow.close();
queryDataSet_datashow.setColumns(new Column[] {column1,column2,column3});
queryDataSet_datashow.open();
jdbTable1.setDataSet(queryDataSet_datashow);
}
jButton_user按钮
void jButton_user_mouseClicked(MouseEvent e) {
Column column1 = new Column();
Column column2 = new Column();
Column column3 = new Column();
Column column4 = new Column();
Column column5 = new Column();
Column column6 = new Column();
//set the sql statement
queryDataSet_datashow.close();
queryDataSet_data_lookup.close();
queryDataSet_datashow.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select id as 序号,user_name as 用户名,user_class as 用户类别 from tab_user", null, true, Load.ALL));
queryDataSet_data_lookup.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select id,class_name as 用户类别 from tab_user_class", null, true, Load.ALL));
//define columns
column1.setColumnName("序号");
column1.setDataType(com.borland.dx.dataset.Variant.INT);
column1.setEditable(true);
column1.setRowId(true);
column1.setPrecision(10);
column1.setTableName("tab_user");
column1.setServerColumnName("id");
column1.setSqlType(4);
column1.setVisible(com.borland.jb.util.TriStateProperty.FALSE);
column2.setColumnName("用户名");
column2.setDataType(com.borland.dx.dataset.Variant.STRING);
column2.setDefault("");
column2.setPrecision(10);
column2.setTableName("tab_user");
column2.setServerColumnName("user_name");
column2.setSqlType(12);
column3.setColumnName("用户类别");
column3.setDataType(com.borland.dx.dataset.Variant.INT);
column3.setPrecision(10);
column3.setEditable(true);
column3.setPickList(new com.borland.dx.dataset.PickListDescriptor(queryDataSet_data_lookup, new String[] {"id"}, new String[] {"用户类别"}, new String[] {"用户类别"},"用户类别",false));
column3.setTableName("tab_user");
column3.setServerColumnName("user_class");
column3.setSqlType(4);
column4.setColumnName("class_id");
column4.setDataType(com.borland.dx.dataset.Variant.INT);
column4.setTableName("tab_user_class");
column4.setServerColumnName("id");
column4.setSqlType(4);
column5.setColumnName("用户类别");
column5.setDataType(com.borland.dx.dataset.Variant.STRING);
column5.setTableName("tab_user_class");
column5.setServerColumnName("class_name");
column5.setSqlType(12);
queryDataSet_data_lookup.close();
queryDataSet_data_lookup.setColumns(new Column[] {column4,column5});
queryDataSet_data_lookup.open();
queryDataSet_datashow.close();
queryDataSet_datashow.setColumns(new Column[] {column1,column2,column3});
queryDataSet_datashow.open();
jdbTable1.setDataSet(queryDataSet_datashow);
}
问题:运行程序,点击jButton_rule按钮,从下拉列表中选择,正确;点击jButton_user按钮,从下拉列表中选择,出现以下错误提示:unknown column name:规则类别.按确定,再点击jButton_rule按钮,从下拉列表中选择,出现错误提示:unknown column name:用户类别.各位大侠,救命!!!!!!!!!!
|
我想你可以用DataSetView组件来解决这个问题。
对于这个问题的详细介绍在
Database user guide 226页上,如你没有我可以mail给你
对于这个问题的详细介绍在
Database user guide 226页上,如你没有我可以mail给你
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。