Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click connection = New SqlConnection("server=.\SQLEXPRESS; Database=NMTC Admissions Database; integrated security=true") connection.Open() If IsNumeric(Tbs.Text) = False Or Tbs.Text = "" Then MessageBox.Show("Enter a Correct Index Number") Tbs.Focus() Exit Sub End If Dim command As New SqlCommand("select [First Name],[other name(s)],Gender, [year of admission], [previous s.h.s], [wassce/ ssce grade],[course to offer],[hostel details],phone,[school fees paid],[email address], std_photo from Tbl_Students5 where std_id = @id", connection) command.Parameters.Add("@id", SqlDbType.VarChar).Value = Tbs.Text Dim table As New DataTable() Dim adapter As New SqlDataAdapter(command) adapter.Fill(table) If table.Rows.Count() <= 0 Then MessageBox.Show("Sorry, That Index Number Does Not Exist") Tbs.Focus() Exit Sub End If TbFn.Text = table.Rows(0)(0).ToString() TbOn1.Text = table.Rows(0)(1).ToString Tbgen.Text = table.Rows(0)(2).ToString Tbdate.Text = table.Rows(0)(3).ToString TbPs.Text = table.Rows(0)(4).ToString TbG.Text = table.Rows(0)(5).ToString TbCo.Text = table.Rows(0)(6).ToString TbHd.Text = table.Rows(0)(7).ToString TbCn.Text = table.Rows(0)(8).ToString TbFp.Text = table.Rows(0)(9).ToString TbE.Text = table.Rows(0)(10).ToString CbF.Checked = False CbM.Checked = False connection.Close() end sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)