求大神啊!![Microsoft][ODBC Microsoft Access Driver]COUNT 字段不正确 50
代码:publicclassHandleRegisterextendsHttpServlet{publicvoidinit(ServletConfigconfig)thr...
代码:
public class HandleRegister extends HttpServlet
{ public void init(ServletConfig config) throws ServletException
{ super.init(config);
try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exception e){}
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
{ Connection con;
PreparedStatement sql;
register reg=new register();
request.setAttribute("register",reg);
String logname=request.getParameter("logname").trim(),
password=request.getParameter("password").trim(),
sex=request.getParameter("sex").trim(),
String uri="jdbc:odbc:Driver={Microsoft Access Driver " +
"(*.mdb, *.accdb)};DBQ=C:\\Users\\rock\\Desktop\\ComeHere.accdb";
if(logname==null)
logname="";
if(password==null)
password="";
boolean isLD=true;
for(int i=0;i<logname.length();i++)
{ char c=logname.charAt(i);
if(!((c<='z'&&c>='a')||(c<='Z'&&c>='A')||(c<='9'&&c>='0')))
isLD=false;
}
boolean boo=logname.length()>0&&password.length()>0&&isLD;
String backNews="";
try{ con=DriverManager.getConnection(uri);
String insertCondition="INSERT INTO member VALUES (?,?,?,?,?,?,?,?)";
sql=con.prepareStatement(insertCondition);
if(boo)
{ sql.setString(1
补充问题不能超过字数限制所以看起来有点麻烦,拜托各位了,哎哎哎
{ sql.setString(1,handleString(logname));
sql.setString(2,handleString(password));
sql.setString(3,handleString(sex));
sql.setInt(4,age);
sql.setString(5,phone);
sql.setString(6,email);
sql.setString(7,handleString(message));
int m=sql.executeUpdate();
if(m!=0)
{ backNews="注册成功"; 展开
public class HandleRegister extends HttpServlet
{ public void init(ServletConfig config) throws ServletException
{ super.init(config);
try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exception e){}
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
{ Connection con;
PreparedStatement sql;
register reg=new register();
request.setAttribute("register",reg);
String logname=request.getParameter("logname").trim(),
password=request.getParameter("password").trim(),
sex=request.getParameter("sex").trim(),
String uri="jdbc:odbc:Driver={Microsoft Access Driver " +
"(*.mdb, *.accdb)};DBQ=C:\\Users\\rock\\Desktop\\ComeHere.accdb";
if(logname==null)
logname="";
if(password==null)
password="";
boolean isLD=true;
for(int i=0;i<logname.length();i++)
{ char c=logname.charAt(i);
if(!((c<='z'&&c>='a')||(c<='Z'&&c>='A')||(c<='9'&&c>='0')))
isLD=false;
}
boolean boo=logname.length()>0&&password.length()>0&&isLD;
String backNews="";
try{ con=DriverManager.getConnection(uri);
String insertCondition="INSERT INTO member VALUES (?,?,?,?,?,?,?,?)";
sql=con.prepareStatement(insertCondition);
if(boo)
{ sql.setString(1
补充问题不能超过字数限制所以看起来有点麻烦,拜托各位了,哎哎哎
{ sql.setString(1,handleString(logname));
sql.setString(2,handleString(password));
sql.setString(3,handleString(sex));
sql.setInt(4,age);
sql.setString(5,phone);
sql.setString(6,email);
sql.setString(7,handleString(message));
int m=sql.executeUpdate();
if(m!=0)
{ backNews="注册成功"; 展开
展开全部
http://www.microsoft.com/zh-cn/download/confirmation.aspx?id=13255 下载32位ACCESS ODBC安敬老装丛源包亮郑升,AccessDatabaseEngine.exe 25.9 MB
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询