Wednesday, March 7, 2012

Microsoft Visual Studio

I am using Microsoft Visual studio and have a question. I need to put
multiple tables on the same report how can I do that? I got this reply to a
previous message but dont understand it
"Depending on your needs, you can either create a dataset that is based
on a query/stored procedure that accesses both tables -or- create 2
separate datasets, each going to a different table and have them
populate different report controls (i.e., table/matrix controls). Hope
this helps."
Can someone please take me through this step by step in detail?On Jul 1, 12:12 am, SQL Server express edition 2005
<SQLServerexpressedition2...@.discussions.microsoft.com> wrote:
> I am using Microsoft Visual studio and have a question. I need to put
> multiple tables on the same report how can I do that? I got this reply to a
> previous message but dont understand it
> "Depending on your needs, you can either create a dataset that is based
> on a query/stored procedure that accesses both tables -or- create 2
> separate datasets, each going to a different table and have them
> populate different report controls (i.e., table/matrix controls). Hope
> this helps."
> Can someone please take me through this step by step in detail?
If you are wanting to combine multiple database tables in a report,
you can write a stored procedure/query including something like this:
select a.*, b.*
from table_a as a
inner join table_b as b on a.x = b.x
Then in the Report in the data view, to the right of Dataset: select
<New Dataset...> and then enter the stored procedure name as the query
string and select Stored Procedure as the command type. Then in the
Layout view, drag-and-drop a table control from the toolbox (Ctrl+Alt
+X). Right click the table control and select Properties. Then on the
General tab, select the dataset you just created below Dataset name:.
Select your header and footer rows via right-clicking the Header/
Footer row and selecting Properties. In the General tab select the
Value (Field from the dataset) you would like to display. If you just
want to display text, instead of right-clicking and selecting
Properties, right-click and select 'Expression...' and enter in
something like: ="Some text here." Do the same for the detail row.
If you want 2 table controls from different database tables, do the
same as above but create your dataset based on a single table or query
of your choice and then repeat for the number of different database
tables or queries you want to use. Just drag-and-dro the number of
different table controls you want to use in the report and repeat the
above steps. I hope this clarifies it a little better for you.
Regards,
Enrique Martinez
Sr. Software Consultant

No comments:

Post a Comment