locked
C# Crystal Report with DataGridView and Textboxes as params

    Question

  •  

    Hi all,

     

    Im new to C# and crystal report and i was wondering if i could get some help with this.

    I currently have a datagridview filled with a datatable from a sql query generated dataset.

    I also have textboxes on the windows form as well.

     

    What i'd like to do is create a print button and have it display whatever is in the textboxes and datagridview as a report.
    How would i go about doing this?

     

    Thanks alot & take care

    Wednesday, January 02, 2008 8:04 AM

Answers


  • You could create the crystal report using the same sql query. Then you could add two parameters to the report and set their values using the textbox's data.


    Wednesday, January 02, 2008 8:21 PM
  • If the dataset is strongly typed you could use it as the schema for a report. This would be the "push" report model.

     

    You would create a new report and the report source, rather than an SP or query would be the schema of your dataset. Once you define it this way datatables in your dataset appear a lot like SQL tables would in the "pull" style reports you might be used to.

     

    The text boxes might be handled as report parameters if there aren't too many. If you have quite a few you could add a table to the dataset that you populate by inserting rows at post back rather than running a query.

     

    If the dataset wasn't too large you could keep it in session to avoid querying the database again if that makes sense.

     

    Do a web search on "crystal .net push model" you'll find many examples of creating reports this way.

    Friday, January 04, 2008 12:40 AM

All replies


  • You could create the crystal report using the same sql query. Then you could add two parameters to the report and set their values using the textbox's data.


    Wednesday, January 02, 2008 8:21 PM
  • Thanks,
    Can anyone give me an example of this being done? I'm really new to crystal reports.

    Take care
    Thursday, January 03, 2008 2:59 PM
  • If the dataset is strongly typed you could use it as the schema for a report. This would be the "push" report model.

     

    You would create a new report and the report source, rather than an SP or query would be the schema of your dataset. Once you define it this way datatables in your dataset appear a lot like SQL tables would in the "pull" style reports you might be used to.

     

    The text boxes might be handled as report parameters if there aren't too many. If you have quite a few you could add a table to the dataset that you populate by inserting rows at post back rather than running a query.

     

    If the dataset wasn't too large you could keep it in session to avoid querying the database again if that makes sense.

     

    Do a web search on "crystal .net push model" you'll find many examples of creating reports this way.

    Friday, January 04, 2008 12:40 AM