rows,err := app.PLADB.Query("SELECT TOP 1 convert(bigint,ID) AS [FSourceInterID] FROM History")
if err != nil {
return
}
defer rows.Close()
var s interface{}
for rows.Next() {
err = rows.Scan(&s)
if err != nil {
panic(err)
}
fmt.Printf("x is of type %T\n", s)
fmt.Println(s)
}
log.Println(app.PLADB.Query("insert into t(id) values (?)",s))
查出来的是bigint类型。然后在插入时,出错
2018/05/05 14:29:34 <nil> sql: converting argument $1 type: unsupported type big.Int, a struct
以下是输出的类型与值
s is of type *big.Int
17121111112102
请指教,这个如何处理
有疑问加站长微信联系(非本文作者)