java.sql.SQLException: [Microsoft][ODBC Microsoft Access 驱动程序] 参数不足,期待是 3。

import java.sql.*;
public class StudentInfoModify
{
public static void main(String[] args)
{
Connection con;
Statement stmt;
ResultSet rs;
String sql;
String number,name;
int speciality;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){}
try
{
con=DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=E:/实训课/电商1401马仲涛/ECStudent.mdb","","");
stmt=con.createStatement();
sql="update StudentInfo set Speciality=电机与电气 where Number='10ZD140115'";
int m=stmt.executeUpdate(sql);
rs=stmt.executeQuery("select * from StudentInfo");
while(rs.next())
{
String Number=rs.getString(2);
String Name=rs.getString(3);
String Speciality=rs.getString(7);

System.out.print("学号:"+Number+"\t");
System.out.print("姓名:"+Name+"\t");
System.out.print("专业:"+Speciality+"\t");
}
con.close();
}
catch(SQLException e)
{ System.out.println(e);}
}
}

把你连接数据库的代码粘上来,可能你连接数据库代码有误,获取的dbconn有误!
str = "select * from user where username="+s2;这里有问题
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-06-20
参数不足,可能是字段名写错了了 。。。。。。。。追问

找不到啊

相似回答