在java中怎么修改sql里的数据啊??已经连接好数据库了

来源:百度知道 编辑:UC知道 时间:2024/05/30 11:25:21
最好具体点啊...小弟比较笨..

import java.sql.*;
import javax.swing.*;

Connection con = null;
Statement sta = null;

try{
Class.forName("sun.jdbd.odbc.jdbdodbcDriver");//加载驱动
con=DriverManager.getconn("jdbc:odbc:数据源");//你获得连接的方法
sta= con.CreateStatement();//实例化执行对象
sta.executeUpdate("update 表名 set 字段= 值 where 条件")
System.out.println("数据库一更新成功 !")
sta.close(); //关闭数据库连接
con.close();
}catch(Exception){
System.out.println("发生了数据库异常");
}
楼主:最主要的还是多看一下书吧?
祝你成绩:蒸蒸日上!

Connection conn = getconn();//你获得连接的方法
Statement stm = conn.CreateStatement();
ing i =stm.executeUpdate("update 表名 set 字段= 值 where 条件");
if(i>1){
System.out.print("成功");
}

你学没学过数据库语言的?
用java修改数据库....-_-!!!!!
statement = conn.createStatement();
statement.execute("这里就是你的update语句");
UPDATE 表名 SET 字段 = *** WHERE *** 借用楼上地
别告诉