Frustrated, Please help.

edited 1:34AM in FastReport .NET
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();
}

Comments

  • edited 1:34AM
    Hello,

    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)?
  • edited 1:34AM
    Hi Alex, thanks for the reply, i need to go and sleep. I have sent you an attachment. But i think what you are saying is true.

    thx again.
  • edited 1:34AM
    Hello,

    Please change your RegisterData method:
    ...
    //report1.RegisterData(bsStockCard, "bsStockCard", BOConverterFlags.AllowFields, 5);
    report1.RegisterData(dsRptStockCard.Tables[0], "qryStockCard");
    ...
    

    The last line will replace the built-in report datasource with the new one.
  • edited October 2009
    Whoa! I cant believe it was that simple! Thanks so much for the help Alex.

    I have also got the setparameter issue working. Thx

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.