zoukankan      html  css  js  c++  java
  • 代码中的mysql语法问题

    今天在代码中写了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表中的数据删除
  • 相关阅读:
    leetcode 对称二叉树
    leetcode 验证二叉搜索树
    蓝桥杯 完美的代价 贪心
    蓝桥杯 字符串对比 模拟
    蓝桥杯 芯片测试 极限找规律
    蓝桥杯 2n皇后问题 深搜
    74. 搜索二维矩阵
    二分 34
    二分 35
    二分 69
  • 原文地址:https://www.cnblogs.com/dongyaotou/p/11629595.html
Copyright © 2011-2022 走看看