Can I get a template to populate a Rpt without DATASET?
What I use is not working. follow the model I use.
private void Carregar()
{
DateTime dt1; dt1 = dtpickerInicial.Value;
DateTime dt2; dt2 = dtpickerFinal.Value;
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
DataSet dsum = new DataSet();
DataTable oTable = new DataTable();
string strReportPath = "";
try
{
strReportPath = @"rptRelatorioCaixa.rdlc";
reportViewer1.LocalReport.ReportPath = strReportPath;
SqlConnection conn = new SqlConnection(Properties.Settings.Default.BD_OneDrive );
cmd.Connection = conn;
cmd.CommandText = "SELECT * FROM CAIXA"; // Where dataSaida between @dtini and @dtfim ";
cmd.CommandType = CommandType.Text;
conn.Open();
SqlDataReader oDataReader = cmd.ExecuteReader();
oTable.Load(oDataReader);
ReportDataSource myReportDataSource = new ReportDataSource(oTable);// da erro pois me cobra um dataSet
reportViewer1.LocalReport.EnableExternalImages = true;
//ReportParameter p = new ReportParameter("Titulo", "Resultado parcial do mes");
//this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p });
reportViewer1.Clear();
if (reportViewer1.LocalReport.DataSources.Count > 0)
reportViewer1.LocalReport.DataSources[0] = myReportDataSource;
else
reportViewer1.LocalReport.DataSources.Add(myReportDataSource);
reportViewer1.RefreshReport();