minmemory,maxmemory是字符串的吧,要用引号

解决方案 »

  1.   

    你把你的那条sql语句粘出来,如果minmemory,maxmemory是变量,注意你的写法!
      

  2.   

    minnemory和maxmemory都是整数
    insert into jobapply (ymd1,hour1,ymd2,hour2,minmemory,maxmemory) values("2001-10-10",'5',"2001-11-11",'1',minmemory,maxmemory);
    这个有问题吗?
      

  3.   

    怎么又是单引号,又是双引号的,而且变量不能直接写在sql语句中的
      

  4.   

    你写的有问题,哪有这样写的?
    请参考:
    int minmemory=...;
    int maxmemory=...;
    String sql="insert into jobapply(ymd1,hour1,ymd2,hour2,minmemory,maxmemory) values('2001-10-10','5','2001-11-11','1',"+minmemory+","+maxmemory+")";
      

  5.   

    Internal Servlet Error:org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fsubmit_0002ejspsubmit_jsp_0.java:103: Invalid character in input.
                           String strsql="insert into  jobsubmission(account,passwd,jobname,arguments,jobtype,count,hostcount,ymd,hour,ymd1,hour1,minmemory,maxmemory) values("+"\'"+account+"\'"+","+"\'"+passwd+"\'"+","+"\'"+jobname+"\'"+","+"\'"+arguments+"\'"+","+"\'"+jobtype+"\'"+",+"\"+"+"count"+"+\""+","+"\"+"+"hostcount"+"+\""+","+"\'"+ymd+"\'"+","+"\'"+hour+"\'"+","+"\'"+ymd1+"\'"+","+"\'"+hour1+"\'"+",+"\"+"+"minmemory"+"+\""+","+"\"+"+"maxmemory"+"\"+);";
                                                                                                                                                                                                                                                                                               ^
    C:\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fsubmit_0002ejspsubmit_jsp_0.java:103: ';' expected.
                           String strsql="insert into  jobsubmission(account,passwd,jobname,arguments,jobtype,count,hostcount,ymd,hour,ymd1,hour1,minmemory,maxmemory) values("+"\'"+account+"\'"+","+"\'"+passwd+"\'"+","+"\'"+jobname+"\'"+","+"\'"+arguments+"\'"+","+"\'"+jobtype+"\'"+",+"\"+"+"count"+"+\""+","+"\"+"+"hostcount"+"+\""+","+"\'"+ymd+"\'"+","+"\'"+hour+"\'"+","+"\'"+ymd1+"\'"+","+"\'"+hour1+"\'"+",+"\"+"+"minmemory"+"+\""+","+"\"+"+"maxmemory"+"\"+);";
                                                                                                                                                                                                                                                                                               ^
    C:\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fsubmit_0002ejspsubmit_jsp_0.java:103: Invalid character in input.
                           String strsql="insert into  jobsubmission(account,passwd,jobname,arguments,jobtype,count,hostcount,ymd,hour,ymd1,hour1,minmemory,maxmemory) values("+"\'"+account+"\'"+","+"\'"+passwd+"\'"+","+"\'"+jobname+"\'"+","+"\'"+arguments+"\'"+","+"\'"+jobtype+"\'"+",+"\"+"+"count"+"+\""+","+"\"+"+"hostcount"+"+\""+","+"\'"+ymd+"\'"+","+"\'"+hour+"\'"+","+"\'"+ymd1+"\'"+","+"\'"+hour1+"\'"+",+"\"+"+"minmemory"+"+\""+","+"\"+"+"maxmemory"+"\"+);";
                                                                                                                                                                                                                                                                                                                                                                                                                              ^
    3 errors at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
      

  6.   

    如果你不会写SQL,就把与数据库的交互问题交给数据库DEVELOPER。
    让它们做一个Facade出来给你就好了。
      

  7.   

    你没有告诉我们你的数据类型(java里的),但即使这样闭着眼睛也知道你里面的大部分\'都得去掉。
      

  8.   

    ("2001-10-10",'5',"2001-11-11",'1',minmemory,maxmemory)'
     ^你的第一个括号好像是全角的吧,程序中也是这样吗?
      

  9.   

    到底是什么错误呢?
    String account=request.getParameter("account");
       String passwd=request.getParameter("passwd");
       String jobname=request.getParameter("jobname");
       String arguments=request.getParameter("arguments");
       String jobtype=request.getParameter("jobtype");
       int count=Integer.parseInt(request.getParameter("count"));
       int hostcount=Integer.parseInt(request.getParameter("hostcount"));
       String ymd1=request.getParameter("year1")+"-"+request.getParameter("month1")+"-"+request.getParameter("date1");
       String hour1=request.getParameter("hour1");
       String ymd=request.getParameter("year")+"-"+request.getParameter("month")+"-"+request.getParameter("date");
       String hour=request.getParameter("hour");
       
       int minmemory=Integer.parseInt(request.getParameter("minmemory"));
       int maxmemory=Integer.parseInt(request.getParameter("maxmemory"));String strsql="insert into  jobsubmission(account,passwd,jobname,arguments,jobtype,count,hostcount,ymd,hour,ymd1,hour1,minmemory,maxmemory) values("+"\'"+account+"\'"+","+"\'"+passwd+"\'"+","+"\'"+jobname+"\'"+","+"\'"+arguments+"\'"+","+"\'"+jobtype+"\'"+",+"\"+"+"count"+"+\""+","+"\"+"+"hostcount"+"+\""+","+"\'"+ymd+"\'"+","+"\'"+hour+"\'"+","+"\'"+ymd1+"\'"+","+"\'"+hour1+"\'"+",+"\"+"+"minmemory"+"+\""+","+"\"+"+"maxmemory"+"\"+);";