Should it be fine tomorrow,we would pay a visit to Mount Emei为什么用should?

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/02 15:57:17
Should it be fine tomorrow,we would pay a visit to Mount Emei为什么用should?

Should it be fine tomorrow,we would pay a visit to Mount Emei为什么用should?
Should it be fine tomorrow,we would pay a visit to Mount Emei
为什么用should?

Should it be fine tomorrow,we would pay a visit to Mount Emei为什么用should?
Should sth happen 是虚拟句型,是固定用法.
相等于 If sth should happen (即 如果某事情 发生/实现/被履行)
通常用来说明后面从句的必有条件.
Should it be fine tomorrow,we would pay a visit to Mount Emei
明天天气要是好的话,我们会去峨眉山玩.
举个类似例句:
Should you renege on your promise,we would sue you.
如果你违背你的承诺,我们将起诉你.

package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java....

全部展开

package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import entity.User;
public class Basedao {

Connection conn = null;
PreparedStatement ps = null;
Statement st = null;
ResultSet rs = null;
List list = new ArrayList();

public boolean getconnection(){
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@localhost:1521:supermarket";
conn = DriverManager.getConnection(url, "yht", "super");
return true;
} catch (ClassNotFoundException e) {
e.printStackTrace();
return false;
} catch (SQLException e) {
e.printStackTrace();
return false;
}

}

public List query(String sql){
getconnection();
try {
st = conn.createStatement();
rs = st.executeQuery(sql);
while(rs.next()){
int id = rs.getInt("id");
int age = rs.getInt("age");

String name = rs.getString("name");
String address = rs.getString("address");
String tel = rs.getString("tel");
String sex = rs.getString("sex");
String power = rs.getString("power");

User u = new User();
u.setAddress(address);
u.setAge(age);
u.setId(id);
u.setName(name);
u.setPower(power);
u.setSex(sex);
u.setTel(tel);

list.add(u);
}
return list;
} catch (SQLException e) {
e.printStackTrace();
return null;
}

}
public int execu(String sql,Object[]parms){
getconnection();
try {
ps = conn.prepareStatement(sql);
for(int i =0;i ps.setObject(i+1, parms[i]);
}
int i = ps.executeUpdate();
return i;
} catch (SQLException e) {
e.printStackTrace();
return 0;
}

}
public boolean close(){
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}

if(ps!=null){
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}

if(st!=null){
try {
st.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}

if(conn!=null){
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}

return true;
}


}

收起