📄 e0cd94687c3f001d1649ea2b2d496e67
字号:
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)+"$";
}
}
catch(Exception e){
}
finally{
try{
psmt.close();
}
catch(Exception e){
}
dbc.close();
}
return rs;
}
public String getMessage2(String code,String code1,String code2){
String rs=null;
CallableStatement calls= null;
sql="{call jisuan(?,?,?,?)}";
try{
calls=dbc.getConnection().prepareCall(sql);
calls.registerOutParameter(4,Types.INTEGER);
calls.setString(1,code);
calls.setString(2,code1);
calls.setString(3,code2);
calls.execute();
int i=calls.getInt(4);
rs="";
rs=i+"$";
}
catch(Exception e){
e.printStackTrace();
}
finally{
try{
calls.close();
}
catch(Exception e){
}
dbc.close();
}
return rs;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -