Frustrated, Please help.
Dear people, this is my only chance to roll out this application, i need help.
Scenario.
--I am using an Access DB in my application.
--I Dragged report1 on my .NET reporter form and using it, i created 2 fast reports from one query in this Access DB(without using a binding source, just connections)
--On this form, i have a procedure that makes an SQL "Filtering" query(Query is Ok.) and i want my button to call any of these two reports using this Filter query.
HOWEVER: this is not happening, Below is what i have. I can see the filtered results of my query in the datagridview but they cant be reflected on the report.
//Preparing my SQL commandText which comes from selecting items in checked list boxes.
tbSQL.Text = strSQL;
_clsMethods.PrepareQuery(strSQL);
private void PreviewReport()
{
if (report1.IsRunning)
return;
CreateReportQuery();
RegisterData();
}
private void RegisterData()
{
if (Directory.Exists(@..\..\Reports))
{
string strReport1 = @..\..\Reports\rptStockCard.frx;
string strReport2 = @..\..\Reports\rptRequisitionIssue.frx;
if (tbReportName.Text == "rptStockCard")
report1.Load(strReport1);
else
report1.Load(strReport2);
DataSet dsRptStockCard = new DataSet();
dsRptStockCard = _clsMethods.FillDataset();
BindingSource bsStockCard = new BindingSource();
bsStockCard.DataSource = null;
bsStockCard.DataSource = dsRptStockCard.Tables[0];
dgvRptTester.DataSource = bsStockCard;
report1.RegisterData(bsStockCard, "bsStockCard", BOConverterFlags.AllowFields, 5);
report1.Show();
}
else
MessageBox.Show("Directory does not exist");
}
protected override void OnClosed(EventArgs e)
{
report1.Dispose();
}
private void btnPreviewRpt_Click(object sender, EventArgs e)
{
PreviewReport();
}
Scenario.
--I am using an Access DB in my application.
--I Dragged report1 on my .NET reporter form and using it, i created 2 fast reports from one query in this Access DB(without using a binding source, just connections)
--On this form, i have a procedure that makes an SQL "Filtering" query(Query is Ok.) and i want my button to call any of these two reports using this Filter query.
HOWEVER: this is not happening, Below is what i have. I can see the filtered results of my query in the datagridview but they cant be reflected on the report.
//Preparing my SQL commandText which comes from selecting items in checked list boxes.
tbSQL.Text = strSQL;
_clsMethods.PrepareQuery(strSQL);
private void PreviewReport()
{
if (report1.IsRunning)
return;
CreateReportQuery();
RegisterData();
}
private void RegisterData()
{
if (Directory.Exists(@..\..\Reports))
{
string strReport1 = @..\..\Reports\rptStockCard.frx;
string strReport2 = @..\..\Reports\rptRequisitionIssue.frx;
if (tbReportName.Text == "rptStockCard")
report1.Load(strReport1);
else
report1.Load(strReport2);
DataSet dsRptStockCard = new DataSet();
dsRptStockCard = _clsMethods.FillDataset();
BindingSource bsStockCard = new BindingSource();
bsStockCard.DataSource = null;
bsStockCard.DataSource = dsRptStockCard.Tables[0];
dgvRptTester.DataSource = bsStockCard;
report1.RegisterData(bsStockCard, "bsStockCard", BOConverterFlags.AllowFields, 5);
report1.Show();
}
else
MessageBox.Show("Directory does not exist");
}
protected override void OnClosed(EventArgs e)
{
report1.Dispose();
}
private void btnPreviewRpt_Click(object sender, EventArgs e)
{
PreviewReport();
}
Comments
Please clarify: your report contains embedded data (you have added it in the FastReport designer, via "Data|Add Data Source..." menu), and now you want to replace this data with the new one (the Datatable from your application)?
thx again.
Please change your RegisterData method:
The last line will replace the built-in report datasource with the new one.
I have also got the setparameter issue working. Thx