benq32


Hello!
I have for example two tables in dataset and want to show in report first table with corresponding values from second table.
first table "PROD"
ID, product, code

second table "DESCR"
code, description

how to view in report

PROD.ID, PROD.product, DESCR.description


Thank you in advance!


Re: Visual Studio Report Controls ReportViewer - table in report from two tables from dataset

eldelo

Create a new table in your dataset. For it's SQL query create a query that pulls the data of interest from the two other tables. Specify the new tables' fields in the report (bind the datasource, etc.)

Is that what you're asking for






Re: Visual Studio Report Controls ReportViewer - table in report from two tables from dataset

benq32

Is it possible without creating additional table




Re: Visual Studio Report Controls ReportViewer - table in report from two tables from dataset

eldelo

I suppose, but I don't know how to do it.

Depending on exactly what it is you intend to implement, you could probably do it using embedded code in the fields.

However, if you're extracting data from two or more tables according to a query (or doing the logical equivalent of a query through some other means), then a table is the most obvious and arguably easiest to use construct for holding and passing around the results.

The ReportViewer also makes displaying data from a single table a snap.

To turn the question around, why would you not want to use a table






Re: Visual Studio Report Controls ReportViewer - table in report from two tables from dataset

Lisa Nicholls

There are two obvious ways to do this

1) Write a single query that joins the data from the two datasource tables into one dataset, like

SELECT PROD.ID, PROD.product, DESCR.description

FROM PROD JOIN DESCR ON PROD.ID = DESCR.ID

(or whatever)

2) Use a subreport -- but it is overkill in this case

... I am really not sure why you would not want to do #1...do you have data access constraints that prevent doing this

>L<