var db, err = sql.Open("mssql", connString) if err != nil { log.Println("Open connection failed:", err) } err = db.Ping() if err != nil { log.Println("Cannot connect: ", err) } defer db.Close() if err != nil { fmt.Println(err.Error()) return "Failed to Connect to Database", err } tx, err := db.Begin() var query string query = ` ` _, err = db.Exec(query) if err != nil { return err.Error(), nil } for _, statusHistory := range data.StatusHistory { var querydetail = `` } _, err = db.Exec(querydetail) if err != nil { return err.Error(), nil } } if err != nil { tx.Rollback() return err.Error(), nil } else { tx.Commit() return "success to Insert Data : ", nil } }
tx.Rollback()
if err != nil {
queryDetail
for
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)