向sql server2000数据库插入
我想在jsp网页中向sql server2000数据库插入<NULL>,前提是先赋给一个变量,判断此变量从其他页面传值是否为null,如果!null 则把传递的值插入数据库。如果为null,则把在这页面声明变量插入数据库,问题出在在这个页面声明变量时该如何??
String rworksname="";//这样插入的是空值
//String rworksname=null;//这样插入的是null
以上两种赋值,结果都不能插入<NULL>,应该怎么赋值?或者有什么其他的办法。
if(request.getParameter("rworksname")!=null)
rworksname=request.getParameter("rworksname");
String sql="insert into mysite(rworksname,pubdate) values('"+rworksname+"',getdate())";
dbconn.executeUpdate(sql);