数据库查询 [英] Database query
问题描述
嗨
我的程序由几个类组成,其中一个是SEARCH类,用于从一个将过滤我的数据库的复选框中选择。以及显示jtable的RESULT类。
我的问题是在搜索类中,当我选择某个单选按钮时,它必须设置一个字符串..然后该字符串被发送到结果在查询中使用它的类。当我点击一个单选按钮时它设置正确但是一旦我从结果类中调用它就会变为空。我错过了什么吗?
搜索类
Hi
my program consists of a few classes where one is a SEARCH class used for selecting for example from a checkbox that will filter my database. and the RESULT class that displays the jtable.
my problem is in the search class when i select a certain radio button it must set a string.. that string is then send to the result class where it is used in the query. when i click on a radio button it sets correct but as soon as i call it from the result class it becomes null. am i missing something?
the Search class
推荐答案
所以你的Result对象运行时可能没有按下任何按钮?显然
变量''q''还没有非空值。你的程序逻辑是内在的:
接收按钮的对象按下(一个ActionEvent mayhap)应该
''将'字符串值输入到Result对象;并且可能让它执行你的
数据库查询。
亲切的问候,
Jos
So your Result object runs while possibly no button whas pressed? Obviously
variable ''q'' doesn''t have a non-null value yet. Your program logic is inside out:
the object that receives the button press even (an ActionEvent mayhap) should
''feed'' the String value to the Result object; and possibly make it execute your
database query.
kind regards,
Jos
所以你的Result对象运行时可能没有按下任何按钮?显然
变量''q''还没有非空值。你的程序逻辑是内在的:
接收按钮的对象按下(一个ActionEvent mayhap)应该
''将'字符串值输入到Result对象;并且可能让它执行你的
数据库查询。
亲切的问候,
Jos
So your Result object runs while possibly no button whas pressed? Obviously
variable ''q'' doesn''t have a non-null value yet. Your program logic is inside out:
the object that receives the button press even (an ActionEvent mayhap) should
''feed'' the String value to the Result object; and possibly make it execute your
database query.
kind regards,
Jos
感谢您的回复,但我不确定我到底知道它必须做什么?
thanks for the reply but im not sure i understand exactly what it is i must do?
这是您的错误,在您的Result类中:
Here is your error, in your Result class:
这篇关于数据库查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!