Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/08/2012, 21:32
asastrem
 
Fecha de Ingreso: agosto-2008
Mensajes: 142
Antigüedad: 15 años, 8 meses
Puntos: 2
DropDownList no trae los datos correctos

buenas noches foreros, mi problema es el siguiente
tengo una pagina donde edito, los datos de un registro, pero al traer la informacion, de los textbox y del dbplite(calendario) me los trae bien, pero de los dropdownlist, no me trae los datos que se corresponden.
aqui mi consulta:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Me.hfId.Value = Request("id")

Using cnn As New SqlConnection(Me.SQLDSInver.ConnectionString)

Dim sel As String
sel = Me.SQLDSInver.SelectCommand & " WHERE IdInver= @p_IdInver"

Dim cmd As New SqlCommand(sel, cnn)
cnn.Open()
cmd.Parameters.AddWithValue("@p_IdInver", CType(Me.hfId.Value, Integer))

Dim tabla As New DataTable
Dim da As New SqlDataAdapter(cmd)
da.Fill(tabla)
If tabla.Rows.Count = 0 Then
Me.lblAviso.Text = "Registro no encontrado contactar al supervisor"
Exit Sub
End If
ddlCanal.SelectedIndex = tabla.Rows(0)("IdCanal") - 1
ddlSubAgencia.SelectedIndex = tabla.Rows(0)("IdAgencia")
ddlCliente.SelectedIndex = tabla.Rows(0)("IdCliente")
Me.txtMonto.Text = tabla.Rows(0)("Monto")
BDPLite1.SelectedDate = IIf(IsDBNull(tabla.Rows(0)("Fecha")), Nothing, tabla.Rows(0)("Fecha"))
ddlStatus.SelectedIndex = tabla.Rows(0)("Status") - 1
Me.txtObs.Text = tabla.Rows(0)("Observacion")
Me.txtNotas.Text = tabla.Rows(0)("Notas")
End Using
End If

End Sub

Gracias por la ayuda