'数据更新 Public Sub updateTable(ByVal StrSql As String) objCommand.CommandText = StrSql Try conSql.Open() Trans = conSql.BeginTransaction objCommand.Transaction = Trans objCommand.ExecuteNonQuery() Trans.Commit() Catch ese As Exception MsgBox(ese.Message) Trans.Rollback() '如果更新异常则取消所有更新 Finally conSql.Close() '关闭连接 End Try End Sub