You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can get the error after reading the result, but the transaction has been rolled back. Can I judge whether the transaction has been rolled back and do not do commit event.
Describe the bug
can not get error for result but log show error msg
To Reproduce
db, _ := conn.GetDb()
tx, err := db.BeginTx(context.Background(), nil)
if err != nil {
return
}
sql := "SELECT * FROM [DispatchMaster] WHERE DispatchMasterID = ''"
_,err = tx.Query(sql)
if err != nil {
tx.Rollback()
return
}
sql = "INSERT INTO MACHINES_STATE (state,display,[desc]) VALUES (?,?,?)"
_,err = tx.Exec(sql,4,"test","test")
if err != nil {
return
}
err = tx.Commit()
if err != nil {
return
}
Expected behavior
output "ERROR 8169 将字符串转换为 uniqueidentifier 时失败" I want query result can get error
Further technical details
SQL Server version: 2016, 2019
Operating system: windows 2016
CREATE Table DispatchMaster (
DispatchMasterID uniqueidentifier
)
The text was updated successfully, but these errors were encountered: