Ver Mensaje Individual
  #8 (permalink)  
Antiguo 28/05/2009, 09:30
Avatar de Dradi7
Dradi7
 
Fecha de Ingreso: junio-2008
Ubicación: Peru - Lima
Mensajes: 1.518
Antigüedad: 15 años, 11 meses
Puntos: 220
Respuesta: tipos de mensajes de error

Código vb:
Ver original
  1. Aqui un Ejemplo de los Errores que mencionas
  2. Imports MySql.Data.MySqlClient
  3. Imports MySql.Data.Types
  4. Imports MySql.Data.Common
  5.  
  6. Private conexion As MySqlConnection
  7. Private sentencias As MySqlCommand
  8.  
  9. Public Function conectar(ByVal oSesion as Sesion) As Boolean
  10.         Dim strCx As String
  11.         If Not conexion Is Nothing Then
  12.             If conexion.State = 1 Then
  13.                 Return True
  14.             ElseIf conexion.State = ConnectionState.Closed Then
  15.                 conexion.Open()
  16.                 Return True
  17.             Else
  18.                 Return False
  19.             End If
  20.         Else
  21.             Try
  22.                 With oSesion.usuario
  23.                     strCx = "Database=" & .Base & ";Data Source=" & .Server & ";User Id=" & .User & ";Password=" & .Pwd & ";Port=" & .Port.ToString & ";CharSet=utf8;Pooling=false;"
  24.                 End With
  25.                 conexion = New MySqlConnection(strCx)
  26.                 conexion.Open()
  27.                 Return True
  28.             Catch ex As MySqlException
  29.                 Select Case ex.Number
  30.                     Case 0
  31.                         MessageBox.Show("El servidor no responde." & ControlChars.CrLf & "Consulte con el Administrador de Sistemas", "Error de conexión principal", MessageBoxButtons.OK, MessageBoxIcon.Error)
  32.                   Case 1045
  33.                         MessageBox.Show("El nombre de usuario o la clave son incorrectas." & ControlChars.CrLf & "Vuelva a ingresarlas", "Error de login", MessageBoxButtons.OK, MessageBoxIcon.Error)
  34.                   Case 1049
  35.                         MessageBox.Show("La base de datos no existe." , "Error de base de datos inexistente", MessageBoxButtons.OK, MessageBoxIcon.Error)
  36.                 End Select
  37.                 Return False
  38.             End Try
  39.             Return True
  40.         End If
  41.     End Function
__________________
La clave de todo triunfador es eliminar todas sus excusas y sus limitaciones