lunes, 15 de diciembre de 2008

BUSQUEDA DE REGISTROS CON PRCEDURE EN VB.NET

Dim cmd As New SqlCommand
Dim buscar As String
buscar = InputBox("Ingrese el codigo a buscar:", "Busqueda de Clientes") cmd.CommandText = "sp_buscar"
cmd.Parameters.Add("@cod", SqlDbType.Char, 5).Value = buscar
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = cn
Dim rs As SqlDataReader
rs = cmd.ExecuteReader
While (rs.Read)
TextBox1.Text = rs.GetString(0)
TextBox2.Text = rs.GetString(1)
TextBox3.Text = rs.GetString(2)
TextBox4.Text = rs.GetString(3)
End While
rs.Close()//Prof. Jhonatan Abal M.