/// <summary> /// Called when the Connection instance receives any messages. /// Resets the MySQLConnection object Message and Errors members. /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Odbc Message Event Arguments</param> private void OnMessage(object sender, OdbcInfoMessageEventArgs e) { if (IsDisposed) { return; } if (e.Errors != null && e.Errors.Count > 0) { OdbcErrorCollection errList = e.Errors; Errors = new OdbcError[errList.Count]; for (int i = 0; i < errList.Count; i++) { Errors[i] = errList[i]; } } else { Errors = null; } Message = e.Message.Length > 0 ? e.Message : null; }
protected static void vControlErrores(OdbcErrorCollection oecErrores) { String sMensajeError = "Equipo: " + Environment.MachineName + Environment.NewLine + "Fecha: " + DateTime.Now + Environment.NewLine + "==================================" + Environment.NewLine; foreach (OdbcError Error in oecErrores) { sMensajeError += "Error " + Error.SQLState + ": " + sSeleccionarError(Error.SQLState) + Environment.NewLine + Environment.NewLine; } MessageBox.Show(sMensajeError, "Hotel San Carlos", MessageBoxButtons.OK, MessageBoxIcon.Error); }