none
Visual Studio 2010 Report Sample in VB

    Question

  • Hi.

    I'm a beginner to Reports in Visual Studio.

    I'm developing an application in VB.NET, Windows Forms; which requires reporting. I have already done most part of it.

    I have a data table which is filled with data from SQL Server; using certain search conditions. Which then needs to be reported. There needs to be grouping of data such that: certain customers & their certain orders.

    e.g.

    Customer: XYZ

    OrderNo. Item Quantity

    01          abc     4

    05          pqr     2

    ----------------------------

    Customer: ASD

    OrderNo. Item Quantity

    11          abc     1

    13          pqr     3

    20          ert      2

    ----------------------------

    and so on.

    I cannot use those wizards since data is loaded in code using certain conditions.

    So I would need a help or some sample that would demanstrate designing a report and load that already loaded data from data table.

    Tuesday, April 27, 2010 10:10 AM

Answers

  • To clarify, by "using certain conditions", do you mean "using a custom query"? If so, see this walkthrough for instructions.

    Otherwise, the Visual Studio Report Designer needs the XSD schema for your data table. Try using DataTable.WriteXmlSchema(filename) to export the XSD first, add it to your project, then you'll be able to add it as a dataset in Report Designer. You then need to bind the actual data to your reportviewer control using something like:

    LocalReport.DataSources.Add(new ReportDataSource(dataSetNameDefinedInReport, yourDataTableObject))

     

     


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, April 27, 2010 2:18 PM
    Moderator
  • Sorry, that walkthrough for VS2010 is here. The link provided above is for VS2008.
    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, April 27, 2010 2:19 PM
    Moderator

All replies

  • To clarify, by "using certain conditions", do you mean "using a custom query"? If so, see this walkthrough for instructions.

    Otherwise, the Visual Studio Report Designer needs the XSD schema for your data table. Try using DataTable.WriteXmlSchema(filename) to export the XSD first, add it to your project, then you'll be able to add it as a dataset in Report Designer. You then need to bind the actual data to your reportviewer control using something like:

    LocalReport.DataSources.Add(new ReportDataSource(dataSetNameDefinedInReport, yourDataTableObject))

     

     


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, April 27, 2010 2:18 PM
    Moderator
  • Sorry, that walkthrough for VS2010 is here. The link provided above is for VS2008.
    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, April 27, 2010 2:19 PM
    Moderator
  • Yes, I have a custom query in code. It's a search query which searches customers by similar names in to a datatable; which is then loaded into a checkbox enabled gridview; then user selects customer records as needed and only selected records are added into another datatable; this new datatable needs to be reported.

    Everything is in code; connection, queries, datatables. Nothing's in solution except forms & classes & the new rdlc report.

    Thanks for the walkthrough link and XSD suggestion; I'll give it a try.

    Wednesday, April 28, 2010 6:46 AM