大虾看看这个问题啊,主要是pstmt.setDate(2,t);这句赋值的问题
import java.net.URL;
import java.sql.*;
import java.util.*;
public class pr_test
{
public static void main(String ags[])
{
String url_set="jdbc:odbc:liyun";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(java.lang.ClassNotFoundException e)
{
System.err.println("ClassNotFoundException:");
System.err.println(e.getMessage());
}
try
{
Connection con=DriverManager.getConnection(url_set,"sa","");
PreparedStatement pstmt=con.prepareStatement("update sales set ord_date=? where stor_id=?");
pstmt.setString(1,"8042");
SimpleDateFormat sdf_temp=new SimpleDateFormat("yyyymmddhhmmss");
String s_date="2002-03-19";
java.util.Date date_temp=sdf_temp.parse(s_date);
Timestamp t=new Timestamp(date_temp.getTime());
pstmt.setDate(2,t);
int n=pstmt.executeUpdate();
con.commit();
pstmt.close();
con.close();
}
catch(java.lang.Exception e)
{
e.printStackTrace();
}
}
}
大虾看看这个问题啊,主要是pstmt.setDate(2,t);这句赋值的问题
SimpleDateFormat是那里的了?????