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 = "[In
entas]"
End If
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 = "[In

End If