可能是你SQL语句写错了
把你的SQL和数据库表仔细对照一下

解决方案 »

  1.   

    没有错啊,是书上源代码,我觉得没有问题 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     Connection con = DriverManager.getConnection("jdbc:odbc:msg");
     Statement smt =  con.createStatement();
     //String name = new String(request.getParameter("name").getBytes("ISO-8859-1"));
    // String note = new String(request.getParameter("note").getBytes("ISO-8859-1"));
    String name = new String(request.getParameter("name"));
    String note = new String(request.getParameter("note"));
     note = newline(note);                   //转换换行字符
     String sql;
     sql="insert into message(昵称,留言) values('"+name+"','"+note+"')";
    //out.print(sql);
     smt.execute(sql);
     con.close();
     response.sendRedirect("main.jsp");
      

  2.   

    还是不行,jsp这么难啊,也没有什么调试工具
      

  3.   

    用executeUpdate(String sql) 代替execute
      

  4.   

    你是不是连接不对("jdbc:odbc:msg")分别是("jdbc","用户名","密码")
      

  5.   

    不是:
    ("jdbc:odbc:msg")其中msg为odbc
      

  6.   

    表定义不对吧
    把 昵称,留言都改成text类型试试
    随便问一句,你用的是什么数据库?
      

  7.   

    那位大虾帮我调下,不胜感谢,很简单的留言簿:
    http://www.aspxcn.com/dotnetbbs/UpImage/2003226901.rar
      

  8.   

    to  loveis(爱是) :
    我已经屏蔽
    ISO-8859-1了to sgdb(三个代表) :是access2000
      

  9.   

    应该不是,是我买一本书自带的,想不到会我错误
    那位朋友帮帮忙,调下:
    http://www.aspxcn.com/dotnetbbs/UpImage/2003226901.rar