?? usercoinselectbean.java
字號:
package com.buy.bean.coin;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.buy.bean.comm.database.DBConnect;
public class UsercoinSelectBean {
public String selectUsercoin(String ID,int i){
String condition;
if(i==0){
condition = "select coin from user where id = '"+ID+"'";
}else if(i==1){
condition = "select consume from user where id = '"+ID+"'";
}else if(i==2){
condition = "select consume + coin from user where id = '"+ID+"'";
}else if(i==3){
condition = "select name from user where id = '"+ID+"'";
}else{
condition = "select type from user where id = '"+ID+"'";
}
ResultSet rs = null;
Statement sql = null;
String str = new String();
try {
Connection conn = DBConnect.getConnection();
sql = conn.createStatement();
rs = sql.executeQuery(condition);
while (rs.next()) {
str = rs.getString(1);
}
rs.close();
sql.close();
conn.close();
} catch (SQLException ex) {
System.out.println("TradeDB SQLException: " + ex.getMessage());
return new String("can not select");
}
return str;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -