mymysql icon indicating copy to clipboard operation
mymysql copied to clipboard

conn.Prepare “wrong number of values for bind ”

Open mejinke opened this issue 11 years ago • 1 comments

stmt, err := conn.Prepare("INSERT INTO `auto_price` VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
    if err != nil {
        return 0, ok
    }

    rs, err := stmt.Run(nil, p.Auto_type_id, p.Auto_brand_id, p.Auto_Company_id, p.Auto_Serial_id, p.Dealer_id, p.Dealer_state, p.Dealer_grade,
        p.Price0, p.Prices, p.Pricediff, p.Discount, p.Updatetime, p.Expiredate, p.Source_level, p.Url, p.Memo, 0, p.Province_id, p.City_id, p.Tichedate, "0")
    if err != nil {
        fmt.Println(err) // "wrong number of values for bind "
        return 0, ok
    } else {
        ok = true
    }

There is no way to know which field is wrong ?

mejinke avatar Jun 08 '13 02:06 mejinke

I'm sorry, is my own negligence, I bind a field value less. -_-

mejinke avatar Jun 08 '13 03:06 mejinke