
07/03/2005, 16:28
|
 | | | Fecha de Ingreso: diciembre-2004
Mensajes: 365
Antigüedad: 20 años, 4 meses Puntos: 1 | |
Este es el codigo del boton
Sub Button1_Click(sender As Object, e As EventArgs)
Dim i As Int32
Dim j As Int32
Dim strSql As String
if viewstate("MbpA")= "si" then
'Cargo el combo busqueda
For i = 0 to Check1.Items.Count-1
if Check1.selectedindex=-1 Then
Iblmessage.Text = "Es necesario que seleccione un servicio"
Else If Check1.Items(i).Selected Then
Iblmessage.Text=""
Dim ds As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
strSql = " SELECT "
For j = 0 To Check1.Items.Count - 1
If Check1.Items(j).Selected Then
strSql += " " & Check1.Items(j).value & ", "
end if
Next
strSql += " Agencia.Agencia as Agencia, Agencia.Direccion as Direccion, Agencia.Telefono as Telefono, Estado.Nombre_Estado as Estado, Ciudad.Nombre_Ciudad as Ciudad, Ubicacion.Descripcion as Ubicación From Agencia, Estado, Ciudad, Ubicacion "
strSql += " WHERE Agencia.EstadoID=Estado.EstadoID"
strSql += " AND Agencia.CiudadID=Ciudad.CiudadID"
strSql += " AND Agencia.UbicacionID=Ubicacion.UbicacionID"
strSql += " AND Agencia.EstadoID=" &DropDownList1.SelectedItem.Value
strSql += " AND Agencia.CiudadID=" &DropDownList2.SelectedItem.Value
strSql += " AND Agencia.UbicacionID=" &DropDownList3.SelectedItem.Value
Else if viewstate("MbpA")= "no"
strSql += "Select Agencia.Agencia as Agencia, Agencia.Direccion as Direccion, Agencia.Telefono as Telefono, Agencia.Cajero_Automatico as Cajero_Automatico, Agencia.Autobanco as Autobanco, Agencia.Taquilla_Externa as Taquilla_Externa, Agencia.Estacionamiento as Agencia_Estacionamiento, Estado.Nombre_Estado as Estado, Ciudad.Nombre_Ciudad as Ciudad, Ubicacion.Descripcion as Ubicación From Agencia, Estado, Ciudad, Ubicacion "
strSql += " WHERE Agencia.EstadoID=Estado.EstadoID"
strSql += " AND Agencia.CiudadID=Ciudad.CiudadID"
strSql += " AND Agencia.UbicacionID=Ubicacion.UbicacionID"
For j = 0 To Check1.Items.Count - 1
If Check1.Items(j).Selected Then
' Entra si esta seleccionado
strSql += " AND " & Check1.Items(j).value & "='si' "
end if
Next
end if
next
end if
if viewstate("MbpA")= "si" then
Iblmessage.Text = CStr(ViewState("MbpA"))
end if
End Sub |