Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim str As String = "Data Source=CPUHP-64\SQLEXPRESS;Initial Catalog=test1;integrated Security=True"
Dim con As New SqlConnection(str)
con.Open()
Dim com As New SqlCommand("select * from student where id_student =' " & T1.Text & "'", con)
Dim reder As SqlDataReader = com.ExecuteReader
If reder.HasRows Then
reder.Read()
T2.Text = reder.Item(1)
T3.Text = reder.Item(2)
T4.Text = reder.Item(3)
T5.Text = reder.Item(4)
reder.Close()
con.Close()
Else
MsgBox("ไม่พบฐานข้อมูล")