AYUDA CON CICLO FOR EACH...NEXT
Publicado por Jacqueline (11 intervenciones) el 09/11/2004 15:13:51
Hola nueva%, tengo este codigo para recorrer una tabla hasta encontrar el valor que busco, lo raro que pongo fechas que estan el la tabla, pero las marca con el color negro y este color indica que no existe diche fecha, pordrian mirar mi codigo y ayudarme a encontrar el porque no recorre la tabla dicho codigo.
---
connection.Open()
Dim adapter As New MySqlDataAdapter("Select fecha_ini,fecha_fin From TMP_RESERVA_HABITACION WHERE habit_rh='" & aux_habit & "' order by fecha_ini", connection)
Dim dset As New DataSet("Pubs")
adapter.FillSchema(dset, SchemaType.Source, "TMP_RESERVA_HABITACION")
adapter.Fill(dset, "TMP_RESERVA_HABITACION")
Dim tbl As DataTable
tbl = dset.Tables("TMP_RESERVA_HABITACION")
Dim fila As DataRow
For Each fila In tbl.Rows
If fila("fecha_ini") = aux_inicio And fila("fecha_fin") = aux_salida Then
habitacion.BackColor = Color.Red
Else
habitacion.BackColor = Color.Black
End If
Next
connection.Close()
---
connection.Open()
Dim adapter As New MySqlDataAdapter("Select fecha_ini,fecha_fin From TMP_RESERVA_HABITACION WHERE habit_rh='" & aux_habit & "' order by fecha_ini", connection)
Dim dset As New DataSet("Pubs")
adapter.FillSchema(dset, SchemaType.Source, "TMP_RESERVA_HABITACION")
adapter.Fill(dset, "TMP_RESERVA_HABITACION")
Dim tbl As DataTable
tbl = dset.Tables("TMP_RESERVA_HABITACION")
Dim fila As DataRow
For Each fila In tbl.Rows
If fila("fecha_ini") = aux_inicio And fila("fecha_fin") = aux_salida Then
habitacion.BackColor = Color.Red
Else
habitacion.BackColor = Color.Black
End If
Next
connection.Close()
Valora esta pregunta


0