Java连接mysql数据库源代码(9)
时间:2025-06-19
时间:2025-06-19
本程序使用Java+Mysql进行编写,其中主要是对数据库进行数据的更新及维护工作,主要界面为DOS界面,如有兴趣的同仁,可修改成GUI界面的,方便进行操作及管理。
Connection conn=DriverManager.getConnection(UrlinforValue, UseNameValue, KeyIDValue);
if(!conn.isClosed())
{
int DeleteSelectValue;
Statement statement=conn.createStatement();
System.out.println("请选择操作类型:1、按姓名删除 2、按密码删除 3、按网址删除");
DeleteSelectValue=EntryValue.nextInt();
switch(DeleteSelectValue){
case 1:
System.out.println("请输入要删除的用户名:");
DeleteUseNameValue=EntryValue.next();
DeleteRecordString="delete from urlinformation
usename='"+DeleteUseNameValue+"'";
statement.executeUpdate(DeleteRecordString);
break;
case 2:
System.out.println("请输入要删除的密码:");
DeleteKeyIDValue=EntryValue.next();
DeleteRecordString="delete from urlinformation
keyid='"+DeleteKeyIDValue+"'";
statement.executeUpdate(DeleteRecordString);
break;
case 3:
System.out.println("请输入要删除的网址:");
DeleteUrlinforValue=EntryValue.next();
DeleteRecordString="delete from urlinformation
urlinfor='"+DeleteUrlinforValue+"'";
statement.executeUpdate(DeleteRecordString);
break;
default:
System.out.println("输入非法字符!");
}
}
} catch (ClassNotFoundException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (SQLException e) {
// TODO 自动生成 catch 块
e.printStackTrace(); where where where
上一篇:韩国兵役制度
下一篇:民营中小企业人事管理初探