queremos consultar los registros de la Base de Datos y mostrarlos sobre un combobox, y no e sido capa, no se si me pueden ayudar es de duma importancia,, gracias cualquier codigo al correro: [email protected] o [email protected].
este es el codigo.




Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim conexion As SqlClient.SqlConnection
Dim comando As SqlClient.SqlCommand
Dim query As String
Dim tabla As New DataTable
conexion =
New SqlClient.SqlConnection()
conexion.ConnectionString = (
"Data Source=DEISYGONZALEZ\SQLEXPRESS;Initial Catalog=SGB;Integrated Security=True")
query = (
"select * from texto where @cod_inventario = '" & Me.TextBox1.Text & "'")
comando =
New SqlClient.SqlCommand
comando.Connection = conexion
comando.CommandText = query
Me.TextBox2.Text = comando.("cod_inventario").ToString
'comando.Parameters.Add("@titulo_texto", SqlDbType.NVarChar).Value = Me.TextBox2.Text
'comando.Parameters.Add("@autor_texto", SqlDbType.NVarChar).Value = Me.TextBox3.Text
Try
conexion.Open()
MsgBox(
"La conexion se a establecido con exito", MsgBoxStyle.Information)
comando.ExecuteNonQuery()
conexion.Close()
Catch ex As Exception
MsgBox(
"Ha habido problemas al intentar establecer conexion" & ex.Message, MsgBoxStyle.Critical)
Finally
conexion.Dispose()
End Try
End Sub
End
Class
cualquier ayuda vienbenida sea......




