dbsqlmanager.java
来自「理发店网上发型设计预约系统」· Java 代码 · 共 74 行
JAVA
74 行
package barbershop.database;
import java.sql.*;
import barbershop.database.*;
public class DBSQLManager
{
protected Connection conn = null;
protected Statement stmt = null;
protected ResultSet rs = null;
protected String sqlStr;
public DBSQLManager()
{
try
{
sqlStr = "";
DBConnection dcm = new DBConnection();
conn = dcm.getConnection();
stmt = conn.createStatement();
}
catch(Exception e)
{
System.out.println(e);
}
}
public Statement getStmt()
{
return stmt;
}
public Connection getConn()
{
return conn;
}
public ResultSet getRs()
{
return rs;
}
public void setSqlStr(String sqlStr)
{
this.sqlStr = sqlStr;
}
public String getSqlStr()
{
return sqlStr;
}
public void executeQuery() throws Exception
{
rs = stmt.executeQuery(sqlStr);
}
public void executeUpdate() throws Exception
{
stmt.executeUpdate(sqlStr);
}
public void close() throws SQLException
{
if(stmt != null)
{
stmt.close();
stmt = null;
}
conn.close();
conn = null;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?