Try
Connections("user").BeginTransaction() '开始事务
Dim cmd As new SQLCommand
cmd.C
cmd.CommandText = "INSERT INTO SZYB.DBO.MAIN (ID,SF) VALUES ('25005001','日本')"
cmd.ExecuteNonQuery
Connections("user").Commit '提交事务,所有操作生效
Catch ex As Exception '如果出错
MessageBox.Show(ex.ToString)
Connections("user").Rollback() '回滚事务,撤销所有操作
End Try