Good Night, it must be simple, but I'm breaking my head and it's not going.
I made a report of the college project "Pieces in Stock" and it is working perfectly. When I ran the tests the DateTime
with the time was reset, then I set the time and my Form is working perfectly.
However, only dates that are zeroed ( 00:00:00
) appear in the report, but when it has a specified time ( 18:35:06
) does not show.
Following the images and code, I'm doing the project in layers, but I have no idea how to do the report by taking the DAO
layer, so I made it in the View
layer. Is it wrong to do so?
code
privatevoidbtnGerar_Click(objectsender,EventArgse){SqlCommandcmd=newSqlCommand();SqlDataAdapterda=newSqlDataAdapter();DataSetdsum=newDataSet();DataTableoTable=newDataTable();StringstrReportPath="";
try
{
strReportPath = @"Report1.rdlc";
reportViewer1.LocalReport.ReportPath = strReportPath;
SqlConnection conn = new SqlConnection(@"Data Source=DENILSON-PC;Initial Catalog=dbSistEstoqueEmp;Integrated Security=True");
cmd.Connection = conn;
cmd.CommandText = "SELECT * FROM tbEntradaEstoque WHERE data_ent = @dataEnt";
cmd.CommandType = CommandType.Text;
conn.Open();
cmd.Parameters.Add("dataEnt", SqlDbType.DateTime).Value = Convert.ToDateTime(maskDataInicial.Text);
SqlDataReader oDataReader = cmd.ExecuteReader();
oTable.Load(oDataReader);
ReportDataSource myReportDataSource = new ReportDataSource("DataSet1", oTable);
reportViewer1.Clear();
reportViewer1.LocalReport.DataSources[0] = myReportDataSource;
reportViewer1.RefreshReport();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
thanks bruno it worked out .date in my parameter.
How am I doing in 4 layers is it wrong to do the reports in the View layer?
Thank you