deletediagnose.java

来自「宠物医院管理系统 包含宠物的注册 管理 收费 诊断等一系列过程控制 还包含配应」· Java 代码 · 共 31 行

JAVA
31
字号
package yd.pethospital.diagnose.jdbc;

import java.sql.*;
import yd.pethospital.share.SystemShare;
import yd.pethospital.diagnoseregister.view.*;

public class DeleteDiagnose {
	
	public DeleteDiagnose(){
		
		try {
			
			SystemShare.getConnection();
			SystemShare.pst=SystemShare.con.prepareStatement("select * from DiagnoseInfo ",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
			
			SystemShare.rs=SystemShare.pst.executeQuery();                                          //rs用于返回SQL语句对数据库的查询等操作 
			SystemShare.rs.absolute(DiagnoseRegister.BTCK.getSelectedRow()+1);          //记录被选择的行
			
			SystemShare.con.prepareStatement("delete DiagnoseInfo where petcode="+SystemShare.rs.getString("petcode")).executeUpdate();   //调用preparement方法进行数据库操作
			
			DiagnoseRegister.frame.dispose();
			SystemShare.delsuccess();
			new DiagnoseRegister();
			
		}catch (SQLException e) {
			SystemShare.delfail();
		}
		SystemShare.close();
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?