日期:2014-05-20 浏览次数:20985 次
package first;
import java.sql.*;
public class Demo123 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Connection ct=null;
Statement sm=null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
ct=DriverManager.getConnection("jdbc:odbc:mytext");
sm=ct.createStatement();
int i=sm.executeUpdate("delect from 123 where name='aaa'");
if(i==1){
System.out.print("添加成功");
}
else
{
System.out.print("添加失败");
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
finally
{
try {
if(sm!=null)
{
sm.close();
}
if(ct!=null)
{
ct.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}