我不能选择...我不能在 go with dates recebe uma variavel que determina quantidade de meses a ser calculada MesesDemanda 中进行选择
for (int i = 1; i <= MesesDemanda; i++)
{
int cont = 0;
DateTime dataposterior = DateTime.Now, dataanterior = DateTime.Now;
dataanterior = dataanterior.AddMonths(i);
dataposterior = dataposterior.AddMonths(-(i - 1));
con.Open();
cmd = new OleDbCommand("SELECT HistSaida.dataHistSaida, HistSaida.idProdutoHistSaida, HistSaida.qtdHistSaida FROM HistSaida WHERE (((HistSaida.dataHistSaida) BETWEEN #" + dataanterior + "# AND #" + dataposterior + "#) AND idProdutoHistSaida = " + idProduto + ")", con);
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
Demanda = Demanda + Convert.ToInt32(dr["qtdHistSaida"]);
cont = 1;
}
}
dr.Close();
con.Close();
Valordivisao = Valordivisao + cont;
}