?? frmjbdmdb.java
字號:
package myprojects.FrmJBDMDb;
import java.sql.*;
public class FrmJBDMDb
{
public ResultSet rs = null;
//public boolean flg = false;
private String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
private String dbConn = "jdbc:odbc:Dbserver";
private Connection con;
private Statement stmt;
//連接數據庫
public boolean getConnection() {
try {
//加載驅動程序
Class.forName(dbDriver);
//建立連接
con = DriverManager.getConnection(dbConn);
//關閉自動提交
con.setAutoCommit(false);
//設定事務級別
con.setTransactionIsolation(con.TRANSACTION_SERIALIZABLE);
//創建一個JDBC聲明
stmt = con.createStatement();
}
catch (Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
return false;
}
return true;
}
/**
* 函數名:getJBDM
* 編寫者:LC
* 功 能:查詢所有疾病代碼
* 輸入參數:無
* 輸出參數:無
* 備 注:
*/
public boolean getJBDM(){
//查詢所有記錄
try{
//ResultSet rs=new ResultSet();
String strSQL="";
strSQL="select * from JBDM";
rs=stmt.executeQuery(strSQL);
}
catch (SQLException e) {
System.out.println(e.getMessage());
e.printStackTrace();
return false;
}
return true;
}
/**
* 函數名:delJBDM
* 編寫者:LC
* 功 能:刪除疾病代碼表中一項記錄
* 輸入參數:疾病代碼ICD編號
* 輸出參數:成功刪除記錄的數目
* 備 注:
*/
public int delJBDM(String strIcd){
//刪除記錄
int count=0;
String strSQL="";
strSQL="delete from JBDM ";
strSQL=strSQL+"where ICD='"+strIcd+"'";
System.out.println(strSQL);
try {
count=stmt.executeUpdate(strSQL);
con.commit();
}
catch(SQLException e){
System.out.println(count);
return -1;
}
System.out.println(count);
return count;
}
/**
* 函數名:insertJBDM
* 編寫者:LC
* 功 能:插入記錄到疾病代碼表中
* 輸入參數:疾病代碼ICD編號,疾病名稱,是否慢性病,是否大額病,結算定額
* 輸出參數:成功插入疾病代碼表的記錄的數目
* 備 注:
*/
public int insertJBDM(String strIcd,String strJbmc,
String strSfmx,String strSfde,String strJsde){
int count=0;
if(strJsde.trim().equals(""))
strJsde = "null";
String strSQL = "";
strSQL = "insert into JBDM values";
strSQL = strSQL + "('"+strIcd+"','"+strJbmc+"','"+strSfmx+"','"+strSfde+"',";
strSQL = strSQL + strJsde + ")";
System.out.println(strSQL);
try{
count=stmt.executeUpdate(strSQL);
con.commit();
}
catch(SQLException e){
System.out.println(count);
return -1;
}
System.out.println(count);
return count;
}
/**
* 函數名:updateJBDM
* 編寫者:LC
* 功 能:修改疾病代碼表中記錄
* 輸入參數:疾病代碼ICD編號,疾病名稱,是否慢性病,是否大額病,結算定額
* 輸出參數:成功修改疾病代碼表中記錄的數目
* 備 注:
*/
public int updateJBDM(String strIcd,String strJbmc,
String strSfmx,String strSfde,String strJsde){
int count = 0;
if(strJsde.trim().equals(""))
strJsde = "null";
String strSQL = "";
strSQL = "Update JBDM SET ";
strSQL = strSQL + "JBMC='"+strJbmc+"',SFMX='"+strSfmx;
strSQL = strSQL +"',SFDE='"+strSfde+"',JSDE="+strJsde;
strSQL = strSQL+" where ICD='"+strIcd+"'";
System.out.println(strSQL);
try{
count=stmt.executeUpdate(strSQL);
con.commit();
}
catch(SQLException e){
return -1;
}
return count;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -