package com.company;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
/**
* Created by ttc on 16-10-27.
*/
public class 更新
{
public static void UpdateDept(int deptno, String DeptName) throws ClassNotFoundException, SQLException
{
Class.forName("oracle.jdbc.driver.OracleDriver");
String st = "jdbc:oracle:thin:@localhost:1521:orcl";
Connection ct = DriverManager.getConnection(st, "scott", "l123456");
Statement sm = ct.createStatement();
String stSQL = "update dept set dname='"+DeptName+"' where deptno="+deptno;
sm.executeUpdate(stSQL);
sm.close();
ct.close();
}
public static void main(String[] args) throws SQLException, ClassNotFoundException
{
UpdateDept(90,"dssda");
}
}
java
最新推荐文章于 2024-09-25 09:01:08 发布
6642

被折叠的 条评论
为什么被折叠?



