Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim intCodCliente As Integer
Dim strNomCliente As String
Dim miExcepcion3 As Exception
If TextBox1.Text = "" Then [COLOR=red](pon el breakpoint en esta linea)[/COLOR]
Label3.Text = "hay que introducir un número de cliente"
Exit Sub
End If
Try
intCodCliente = CInt(TextBox1.Text)
Catch miExcepcion As Exception
Label3.Text = "Hay que introducir un número de cliente"
Exit Sub
End Try
Try
SqlConnection1.Open()
Catch miExcepcion1 As Exception
Label3.Text = "no se puede abrir la conexion"
Exit Sub
End Try
Try
SqlCommand1.CommandText = "select NombreCliente from clientes where idCliente = " & intCodCliente & ""
strNomCliente = SqlCommand1.ExecuteScalar
Session("NombreCliente") = strNomCliente
If strNomCliente = "" Then
Throw miExcepcion3
End If
Label3.Text = "usuario : " & strNomCliente & ""
Panel1.Visible = True
Button2.Visible = True
Button3.Visible = True
Session("idCliente") = intCodCliente
Catch miExcepcion3
Label3.Text = "Este cliente no existe"
Panel1.Visible = False
Button2.Visible = False
Button3.Visible = False
Exit Sub
Finally
SqlConnection1.Close()
End Try
End Sub