📄 b02fdf8a303d001d17a69a638fd816af
字号:
package com.ajax;
import java.io.*;
import java.util.*;
import java.sql.*;
import com.jdbc.*;
public class Ajax {
Statement psmt=null;
ResultSet rt =null;
String sql =null;
DataBaseConnection dbc = new DataBaseConnection();
public String getMessage(){
String rs=null;
int i=0;
sql="select number,name from ajax where number1 is null order by name";
try{
psmt=dbc.getConnection().createStatement();
rt=psmt.executeQuery(sql);
rs="";
while (rt.next()) {
rs = rs+ "<option value=\"" + rt.getString(1) + "\""; //从1开始的
if (i == 0) {
rs = rs + " selected ";
}
rs = rs + ">" + rt.getString(2) + "</option>";
i++;
}
}
catch(Exception e){
}
finally{
try{
psmt.close();
}
catch(Exception e){
}
dbc.close();
}
return rs;
}
public String getMessage(String code){
String rs=null;
sql="select distinct name from ajax where number1='"+code+"' ";
try{
psmt=dbc.getConnection().createStatement();
rt=psmt.executeQuery(sql);
rs="";
while (rt.next()) {
//rs = rs + rt.getString(1)+","+ rt.getString(2)+"$";
rs = rs + rt.getString(1)+"$";
}
}
catch(Exception e){
}
finally{
try{
psmt.close();
}
catch(Exception e){
}
dbc.close();
}
return rs;
}
public String getMessage1(String code){
String rs=null;
sql="select distinct number from ajax where name='"+code+"' ";
try{
psmt=dbc.getConnection().createStatement();
rt=psmt.executeQuery(sql);
rs="";
while (rt.next()) {
rs = rs + rt.getString(1)+","+ rt.getString(2)+"$";
}
}
catch(Exception e){
}
finally{
try{
psmt.close();
}
catch(Exception e){
}
dbc.close();
}
return rs;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -