Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/04/2003, 09:27
Avatar de Henry Zapata
Henry Zapata
 
Fecha de Ingreso: abril-2001
Mensajes: 125
Antigüedad: 23 años, 11 meses
Puntos: 0
Hola Noemi:

Por si todavia no logras resolover tu problema, aqui te dejo un código que hace exactamente lo que deseas. Te escribo aqui mismo el código y levantaré por un momento la prueba en mi pc.

URL:

http://200.106.30.85/Practica/combo.aspx

CODIGO:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
'Cargando el combo
cnPubs.ConnectionString = "data source=atenas;initial catalog=pubs; user id=sa; pwd="
cnPubs.Open()
cmAutores.Connection = cnPubs
cmAutores.CommandText = "Select * from authors"
cmAutores.CommandType = CommandType.Text
drAutores = cmAutores.ExecuteReader
comboAutores.DataSource = drAutores
comboAutores.DataTextField = "au_lname"
comboAutores.DataValueField = "au_id"
comboAutores.DataBind()
drAutores.Close()
cnPubs.Close()
End If
End Sub

Private Sub comboAutores_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboAutores.SelectedIndexChanged
cnPubs.ConnectionString = "data source=atenas;initial catalog=pubs; user id=sa; pwd="
cnPubs.Open()
cmAutores.Connection = cnPubs
cmAutores.CommandText = "Select * from titleauthor where au_id = '" & comboAutores.SelectedItem.Value & "'"
cmAutores.CommandType = CommandType.Text
drAutores = cmAutores.ExecuteReader
dgAutores.DataSource = drAutores
dgAutores.DataBind()
drAutores.Close()
cnPubs.Close()

End Sub

saludos!!