求JAVA代码……增删改查SQL2000数据库! 给个范例就行 ,做个简单的教育经历管理系统,就几张表要简单的!越简单越好 尤其修改和删除! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class UserSystem { public static void main(String args[]){ UserSystemDAO UserSystemDAO=new UserSystemDAO(); }} import java.sql.*;public class UserSystemDAO { String insertSql="insert into table_usersystem_dictionary values(?,?,?,?)"; UserSystemDAO(){ executeSQL(); } private void executeSQL(){ UserSystemDB userSystemDB=new UserSystemDB(); PreparedStatement preparedStatement=null; Connection connection=userSystemDB.createConnection(); try{ preparedStatement=connection.prepareStatement(insertSql); preparedStatement.setString(1, "95002"); preparedStatement.setString(2,"user"); preparedStatement.setString(3,"shl"); preparedStatement.setString(4,"001"); preparedStatement.addBatch(); preparedStatement.executeBatch(); preparedStatement.close(); System.out.println("Insert success"); } catch(Exception e){e.printStackTrace();} finally{ try{ connection.close(); } catch(Exception e){e.printStackTrace();} } }} import java.sql.Connection;import java.sql.DriverManager;public class UserSystemDB { public Connection createConnection(){ Connection connection=null; try{ Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); //String url="jdbc:odbc:argon"; String url="jdbc:microsoft:sqlserver://Localhost:1433;DatabaseName=user"; connection=DriverManager.getConnection(url,"sa",""); System.out.println("JDBC-ODBC的驱动程序注册成功"); } catch(Exception e){ e.printStackTrace(); System.out.println("找不到驱动程序"); } return connection; }} 更新用preparedStatement.update 你看下java基础吧 更新是这个preparedStatement.excuteupdate 2楼错了 不好意思 小游戏菜单重新开始问题 三元运算符 判断性别? 关于java扫雷 JAVA中怎么往文件中加入ArrayList(我是菜鸟,希望大家帮帮我) 一个java连接数据库的问题 上传文件javabean的原理! 客户端和服务器段不断传输数据流的问题 java Applet 图像加载 请问在JBuilder中程序里用到的图形文件在哪个目录下? 用java swing JTable做一个属性编辑器遇到的问题,请高手赐教!急,急!! 请教一个 Java String 的问题.. 序列化小问题
public class UserSystem {
public static void main(String args[]){
UserSystemDAO UserSystemDAO=new UserSystemDAO();
}
}
import java.sql.*;
public class UserSystemDAO {
String insertSql="insert into table_usersystem_dictionary values(?,?,?,?)";
UserSystemDAO(){
executeSQL();
}
private void executeSQL(){
UserSystemDB userSystemDB=new UserSystemDB();
PreparedStatement preparedStatement=null;
Connection connection=userSystemDB.createConnection();
try{
preparedStatement=connection.prepareStatement(insertSql);
preparedStatement.setString(1, "95002");
preparedStatement.setString(2,"user");
preparedStatement.setString(3,"shl");
preparedStatement.setString(4,"001");
preparedStatement.addBatch();
preparedStatement.executeBatch();
preparedStatement.close();
System.out.println("Insert success");
}
catch(Exception e){e.printStackTrace();}
finally{
try{
connection.close();
}
catch(Exception e){e.printStackTrace();}
}
}
}
import java.sql.Connection;
import java.sql.DriverManager;
public class UserSystemDB {
public Connection createConnection(){
Connection connection=null;
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
//String url="jdbc:odbc:argon";
String url="jdbc:microsoft:sqlserver://Localhost:1433;DatabaseName=user";
connection=DriverManager.getConnection(url,"sa","");
System.out.println("JDBC-ODBC的驱动程序注册成功");
}
catch(Exception e){
e.printStackTrace();
System.out.println("找不到驱动程序");
}
return connection;
}
}