jtextfield的值传入mysql数据库,
Stringpid=jtf1.getText();Stringpname=jtf2.getText();Stringpsource=jtf3.getText();Stri...
String pid = jtf1.getText();
String pname =jtf2.getText();
String psource =jtf3.getText();
String pmoney= jtf4.getText();
String prole = jtf5.getText();
String ptime =jtf6.getText();
String sql = "insert into car_information values('" + pid + "','"+ pname + "','" + psource + "','" + pmoney+ "','" + prole + "','" + ptime + "')";
st.executeUpdate(sql);
请问是哪里错了呢,com.mysql.jdbc.StatementImpl cannot be cast to com.mysql.jdbc.PreparedStatement这是错误提示,数据库那边都是varchar类型 展开
String pname =jtf2.getText();
String psource =jtf3.getText();
String pmoney= jtf4.getText();
String prole = jtf5.getText();
String ptime =jtf6.getText();
String sql = "insert into car_information values('" + pid + "','"+ pname + "','" + psource + "','" + pmoney+ "','" + prole + "','" + ptime + "')";
st.executeUpdate(sql);
请问是哪里错了呢,com.mysql.jdbc.StatementImpl cannot be cast to com.mysql.jdbc.PreparedStatement这是错误提示,数据库那边都是varchar类型 展开
1个回答
2017-05-09
展开全部
1、连接数据库 2、执行查询 3、根据查询结果设置文本
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询