今天在代码中写了mysql的删除语句
1 String lpinsuredSQL=" delete from lpinsured a where a.insuredid='?InsuredID?' and a.edorcode='?EdorCode?' and a.edorno='?EdorNo?' "; 2 SQLwithBindVariables sqlbv3=new SQLwithBindVariables(); 3 sqlbv3.sql(lpinsuredSQL); 4 sqlbv3.put("InsuredID",mInsuredID); 5 sqlbv3.put("EdorCode","BC"); 6 sqlbv3.put("EdorNo",mEdorNo); 7 mMap.put(lpinsuredSQL,"DELETE");//将lpinsured表中的数据删除
这样写完之后,在运行代码的时候,莫名其妙的报错了。
最后自己将别名去掉,在数据库进行执行,执行成功。
delete from lpinsured where insuredid='testMGU000054' and edorcode='BC' and edorno='EN20190926001'
所以,以后自己要这样写:
1 String lpinsuredSQL=" delete from lpinsured where insuredid='?InsuredID?' and edorcode='?EdorCode?' and edorno='?EdorNo?' "; 2 SQLwithBindVariables sqlbv3=new SQLwithBindVariables(); 3 sqlbv3.sql(lpinsuredSQL); 4 sqlbv3.put("InsuredID",mInsuredID); 5 sqlbv3.put("EdorCode","BC"); 6 sqlbv3.put("EdorNo",mEdorNo); 7 mMap.put(lpinsuredSQL,"DELETE");//将lpinsured表中的数据删除