使用java update access时遇到的问题

来源:百度知道 编辑:UC知道 时间:2024/05/15 03:37:48
代码如下 运行的时候却老是报告:“修改失败2”
哪位大侠能给看看哪错了 谢谢
///////////////////////////////////////////////修改
if (e.getSource() == subMenu2[3] || e.getSource() == toolBarButton[3])
{
String idid = JOptionPane.showInputDialog("请输入你要修改的学生姓名后点击提交修改键确认");
if (idid.trim() != "")
{
String strSQL = "select * from stuinfo"+" where name='"+idid+"' ";
try
{
rs = st.executeQuery(strSQL);
int count = 0;
while (rs.next())
{
classid = rs.getString("classid");
name = rs.getString("name");
department = rs.getString("department");
sex = rs.getString("sex");
age = rs.getString("age");
call = rs.getString("call");
++count;
}
if (count == 0)
{
JOptionPane.showMessageDialog(null, "无此信息");
}
else
{
classidT.setText(classid);
nameT.setText(name);

代码错了
String strSQL =
"update stuinfo(classid,name,sex,age,call,department)"+ "values( '"+
classid +"' , '"+name +"' , '"+ sex +"' , '"+ age +"' , '"+ call +"' , '"+
department +"' )";
改成
String strSQL = "update stuinfo"+ " set classid='" + classid +"',sex= '"+ sex +"' ,age= '"+
age + "',call= '"+call + "',department= '"+ department + "'" +" where + name ";
试试