customerqueryAction.java
上传用户:flow_meter
上传日期:2022-03-21
资源大小:40k
文件大小:1k
- package sql_lab;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import org.eclipse.jface.action.Action;
- import org.eclipse.swt.widgets.Text;
- public class customerqueryAction extends Action {
- public customerqueryAction(){
- super();
- this.setText("查看所有客户信息(&K)");
- this.setToolTipText("查看所有客户信息");
- }
- public void run(){
- /*if(MainWindow.log==false){
- Text content=MainWindow.getApp().getContent();
- content.append("请您先登陆n");
- return ;
- }*/
- String str="select * from "+sqlManager.tb_customer;
- sqlManager sql=sqlManager.getSqlManager();
- ResultSet set=sql.executeQuery(str);
- Text content=MainWindow.getApp().getContent();
- boolean flag=false;
- String s="***********************************客户信息查询结果**********************************n";
- try{
- while(set.next()){
- flag=true;
- content.append(s);
-
- content.append("客户ID: "+set.getInt(1)+" n");
- content.append("客户名称: "+set.getString(2)+"n");
- content.append("客户地址: "+set.getString(3)+"n");
- content.append("厂家电话: "+set.getString(4)+"n");
- content.append("客户邮箱 "+set.getString(5)+"n");
- content.append("客户注册时间 "+set.getString(6)+"n");
-
- }
- }
- catch(SQLException e){
- e.printStackTrace();
- }
- content.append(s);
- if(flag==false)content.append("查询结果为空n");
- }
- }