用JDBC向oracle数据库插入数据时提示java.sql.SQLException: ORA-00917: 缺失逗号
插入语句stat.executeQuery("insertintoaddresslistvalues("+"'"+md.shcoolnum.getText()+"'"+"...
插入语句stat.executeQuery("insert into addresslist values (" + "'" +
md.shcoolnum.getText() + "'" + "," +
md.name.getText() + "'" + "," + "'" +
md.roomname.getText() + "'" + ","+ "'" +
md.roomphone.getText() + "'" + "," + "'" +
md.homephone.getText() + "'" + "," + "'" +
md.mobilephone.getText() + "'" + "," + "'" +
md.qqnum.getText() + "'" + "," + "'" +
md.email.getText() + "'" + "," + "'" +
md.remark.getText() + "'" +")"); 展开
md.shcoolnum.getText() + "'" + "," +
md.name.getText() + "'" + "," + "'" +
md.roomname.getText() + "'" + ","+ "'" +
md.roomphone.getText() + "'" + "," + "'" +
md.homephone.getText() + "'" + "," + "'" +
md.mobilephone.getText() + "'" + "," + "'" +
md.qqnum.getText() + "'" + "," + "'" +
md.email.getText() + "'" + "," + "'" +
md.remark.getText() + "'" +")"); 展开
2013-06-10
展开全部
如果你在SQL的表面看不到有任何逗号少了,那么你就要查那些 getText() 返回的字符串里面有没有逗号存在了。
按现在这样的情况来看,应该是其中一个或多个 getText() 里面存在逗号了。
建议你平时使用SQL时用 PrepardedStatment 来一个一个 setString 设置SQL的值,这样即使任何 getText() 里面有任何逗号,都不会出现问题,即使是 null 也不会出现问题。
按现在这样的情况来看,应该是其中一个或多个 getText() 里面存在逗号了。
建议你平时使用SQL时用 PrepardedStatment 来一个一个 setString 设置SQL的值,这样即使任何 getText() 里面有任何逗号,都不会出现问题,即使是 null 也不会出现问题。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
能不能先用?代替 md.shcoolnum.getText()这些属性
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询