用的go1.16.15 使用的sqlserver2008r2数据库,github.com/denisenkom/go-mssqldb
下面代码中报错,
报错的代码行为
row = tx.QueryRow("select cast(newid() as varchar(40)), CONVERT(CHAR(10),GETDATE(), 120) ")
err := row.Scan(&guidstr, &currdate)
错误信息为:unknown token type returned: token(45)
有大佬知道这是什么原因不?有解决的方法吗?
tx, err = xjcdb.DB.Begin()
if err != nil {
log.Println(err.Error())
return 0, "", err
}
defer tx.Rollback()
......
......
rows, err = tx.Query(...)
if err != nil {
log.Println(err.Error())
return 0, "", err
}
defer rows.Close()
for rows.Next() {
loop_beltcode = ""
loop_pkfeeobj = ""
err = rows.Scan(&loop_beltcode, &loop_pkfeeobj)
if err != nil {
log.Println(err.Error())
return 0, "", err
}
guidstr = ""
currdate = ""
row = tx.QueryRow("select cast(newid() as varchar(40)), CONVERT(CHAR(10),GETDATE(), 120) ")
err := row.Scan(&guidstr, &currdate)
if err != nil {
return 0, "", err
}
......
......
}
.....