在前面用xlbh=request.getParameter("xlbh")
的方式分别得到qsrq,zzrq,sjdwbh1,xlbh并且用out.println(xlbh);的方式分别看过qsrq,zzrq,sjdwbh1,xlbh的值都是正常的。
而且也用 if(xlbh == null)xlbh="aaa";做过保护。
执行到这一步:
double result = pubc.instempcxtjb(qsrq,zzrq,sjdwbh1,xlbh);
报一个空指针错误。
百思不得其解,为什么会有空指针呢?
多谢!
这个函数是往tempcxtjb插数据 public double instempcxtjb(String qsrq,String zzrq,String sjdwbh1,String xlbh)
{
double count=0;
String str1 = "";
if(xlbh.equals("al"))
{
str1="insert into temp_cxtjb select '*' as cxmc ,clbh as clbh, sjyxgl as xsgl,ylhj as shy,9999 as shc, 9999 as shlt,lqf as lqf,clf as clf,9999 as fyhj,9999 as pjfy,9999 as wxgs,9999 as pjgs from tldk where ldrq>='"+qsrq+"' and ldrq <='"+zzrq+"' and sjdwbh='"+sjdwbh1+"' and hdbz='1'";
}else{
str1="insert into temp_cxtjb select '*' as cxmc ,clbh as clbh, sjyxgl as xsgl,ylhj as shy,9999 as shc, 9999 as shlt,lqf as lqf,clf as clf,9999 as fyhj,9999 as pjfy,9999 as wxgs,9999 as pjgs from tldk where ldrq>='"+qsrq+"' and ldrq <='"+zzrq+"' and xlbh='"+xlbh+"' and hdbz='1' and sjdwbh='"+sjdwbh1+"'";
}
try{
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
count = stmt.executeUpdate(str1);
stmt.close();
conn.close();
} catch (Exception e)
{
System.out.print("出现例外!" + e.getMessage());
e.printStackTrace();
return -1;
}
return count;
}
的方式分别得到qsrq,zzrq,sjdwbh1,xlbh并且用out.println(xlbh);的方式分别看过qsrq,zzrq,sjdwbh1,xlbh的值都是正常的。
而且也用 if(xlbh == null)xlbh="aaa";做过保护。
执行到这一步:
double result = pubc.instempcxtjb(qsrq,zzrq,sjdwbh1,xlbh);
报一个空指针错误。
百思不得其解,为什么会有空指针呢?
多谢!
这个函数是往tempcxtjb插数据 public double instempcxtjb(String qsrq,String zzrq,String sjdwbh1,String xlbh)
{
double count=0;
String str1 = "";
if(xlbh.equals("al"))
{
str1="insert into temp_cxtjb select '*' as cxmc ,clbh as clbh, sjyxgl as xsgl,ylhj as shy,9999 as shc, 9999 as shlt,lqf as lqf,clf as clf,9999 as fyhj,9999 as pjfy,9999 as wxgs,9999 as pjgs from tldk where ldrq>='"+qsrq+"' and ldrq <='"+zzrq+"' and sjdwbh='"+sjdwbh1+"' and hdbz='1'";
}else{
str1="insert into temp_cxtjb select '*' as cxmc ,clbh as clbh, sjyxgl as xsgl,ylhj as shy,9999 as shc, 9999 as shlt,lqf as lqf,clf as clf,9999 as fyhj,9999 as pjfy,9999 as wxgs,9999 as pjgs from tldk where ldrq>='"+qsrq+"' and ldrq <='"+zzrq+"' and xlbh='"+xlbh+"' and hdbz='1' and sjdwbh='"+sjdwbh1+"'";
}
try{
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
count = stmt.executeUpdate(str1);
stmt.close();
conn.close();
} catch (Exception e)
{
System.out.print("出现例外!" + e.getMessage());
e.printStackTrace();
return -1;
}
return count;
}
解决方案 »
- EntityManager 一直为空!为何?!
- 谁能推荐一些学习JSP的教材
- 急问在网页中添加JApplet中java的权限问题????
- b/s系统如何实现读卡
- 我的jsp运行不了 看看我应该怎么做呢?
- 很简单的 改错题 (为什么啊??)
- ****紧急求救,用SmartUpload时出现 package com.jspsmart.upload does not exist***,在线等!!!
- 如何将多选列表框中的所选择的数据传给服务器端(如java变量或request)
- java import 出错
- 怎样用SQL语句得到查询结果的记录数?100分啊!
- JSP在本机能访问,从别的机器访问就找不到网页,会是什么原因
- 怎样控制socket使之不断接收和发送?
你可以在这一步上面把可能为空的都打出来看看咯
pubc,qsrq,zzrq,sjdwbh1,xlbh什么的
pubc里面写的全都是公用函数是一个class
在进入方法之前就报空了 所以我很怀疑是你的pubc有问题
但是总指向这一行有错误239: <%
难道真是这里的问题?System.out.println(pubc==null);打印出来false
同意上述公约者·申请加入!
QQ群号:25922618