1

我定义订单结构,如 t

type Order struct {
    Id      nullString `db:"O_ID"`
    CusTel  int64      `db:"O_CUS_TEL"`
}

当我打电话时,我安装了一个 Order 对象作为订单:dbmap.SelectInt("SELECT count(*) FROM ORDERS WHERE O_ID=?",o.Id) 我收到了这样的错误:

[gorp] SELECT count(*) FROM ORDERS WHERE O_ID=? []
Search order by id:{{00000001 true}} fail:Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1

但如果我这样使用它:

dbmap.Db.Exec("SELECT count(*) FROM ORDERS WHERE O_ID=?",o.Id)

完成了。

我不知道为什么?

4

0 回答 0