You are on page 1of 1

Dim jvf = "select

codigodoctor,Nombre,ApellidoP,ApellidoM,Telefono,Profesion,Especialidad,Direccion
from doctor"
Dim comando = New MySqlCommand(jvf, myconexion)
Dim reader = comando.ExecuteReader()
DataGridView1.Rows.Clear()
DataGridView1.Refresh()
If reader.HasRows Then
While reader.Read()
Dim n = DataGridView1.Rows.Add()
DataGridView1.Rows(n).Cells(0).Value =
reader.GetString(0).ToString
DataGridView1.Rows(n).Cells(1).Value =
reader.GetString(1).ToString
DataGridView1.Rows(n).Cells(2).Value =
reader.GetString(2).ToString
DataGridView1.Rows(n).Cells(3).Value =
reader.GetString(3).ToString
DataGridView1.Rows(n).Cells(4).Value =
reader.GetString(4).ToString
DataGridView1.Rows(n).Cells(5).Value =
reader.GetString(5).ToString
DataGridView1.Rows(n).Cells(6).Value =
reader.GetString(6).ToString
DataGridView1.Rows(n).Cells(7).Value =
reader.GetString(7).ToString
End While
Console.WriteLine("no ay registro")

End If

Catch ex As Exception
MsgBox("ERROR DE CONEXION " & ex.ToString)
End Try

You might also like