Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/01/2012, 07:41
tienda
 
Fecha de Ingreso: diciembre-2011
Mensajes: 70
Antigüedad: 12 años, 5 meses
Puntos: 2
Select no funciona

Hola amigos, tengo un código dónde el else funciona de maravilla pero el el primer if no me funciona, no lanza error ni nada..simplemente no funciona, alguien puede saber por qué?¿?

Cita:
If CheckMostrador.Checked = True Then

Dim adapta2 As New OleDbDataAdapter
Dim datavacio As New DataSet


Dim comados = conexion.CreateCommand
comados.CommandType = CommandType.Text

comados.CommandText = "SELECT Fecha,Anulado, ROUND(Sum(Cantidad*P),2) AS TOTAL From [Inentas] where Anulado = 0 and Fecha between #01/01/" & ComboAno.Text & "# and #01/31/" & ComboAno.Text & "# group by Fecha,Anulado"

borratextos()
adapta2.SelectCommand = comados
adapta2.Fill(datavacio, "[Inentas]")

DgTotales.DataSource = datavacio
DgTotales.DataMember = "[Inentas]"

Else
Dim adapta2 As New OleDbDataAdapter
Dim datavacio As New DataSet


Dim comados = conexion.CreateCommand
comados.CommandType = CommandType.Text

comados.CommandText = "SELECT Fecha,Anulado,B,N, ROUND(Sum(Cantidad*P),2) AS TOTAL From [Inentas] where B = @combo1 and N = @combo2 and Anulado = 0 and Fecha between #01/01/" & ComboAno.Text & "# and #01/31/" & ComboAno.Text & "# group by Fecha,Anulado,B,N"

comados.Parameters.AddWithValue("@combo1", ComboMostrador.SelectedValue.ToString)
comados.Parameters.AddWithValue("@combo2", ComboTerminal.SelectedValue.ToString)

borratextos()
adapta2.SelectCommand = comados
adapta2.Fill(datavacio, "[Inentas]")

DgTotales.DataSource = datavacio
DgTotales.DataMember = "[Inentas]"

End If