Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with dataset interaction VB.NET <-> CR

Status
Not open for further replies.

Cereal1

Programmer
Mar 6, 2002
4
BE
Hi there,

I'm working with VB.NET and the CR provided with VS.NET.

I want to do the following :
- run an sql-statement in VB.NET, pass the dataset to CR and
show the resulting report.

What I did :

- added a dataset to my project. This dataset contains the
table and the fields that I want to see in my report ->
dataset1.xsd
- in my rpt, I did an "Add/Remove Database" and selected
the created dataset (dataset1.xsd).
When this was done, I can drag a datafield into the
details section of my report.
- fill a dataset in code. Remark : this is an instance of
the 'normal' dataset class => not of dataset1
- give this dataset to the datasource of the rpt

This is working just fine as long as I use only 1 table in my dataset ...

f.e. : sql-statement "Select * from orders"

You also know that such easy queries are 'endangeroud species' :).
So I need a query with some joins. This means that I will have more than 1 table in my xsd. So also in my CR, I will have multiple tables in the "DataBase Fields" block of the Field Explorer.

In code however, I still execute only 1 query (with the joins) which means that my dataset will only contain 1 datatable.
I have the impression that CR expects a datatable for each table it has in the "Database Fields". Is this impression correct?

Do you know what I'm doing wrong here?
Or what I have to do to get a report containing fields of multiple tables while the input for CR was a dataset with 1 datatable?

Thanks!!
 
Hi...

Did you get this issue resolved? I'm having similar problems, except right now, I can't even get one table to show...it works on their sample, and I can't see the difference between mine and theirs. I don't understand the dataset bit - do you need to add a dataset to the form as well as creating one in code? I would think you could do either/or, but my report keeps showing up with headers only.

If you came across any documentation or have tips that would help, I would appreciate it.

cheers-
sheri
 
Hi Sheri,

I managed to solve this thing by adding a datatable to the same dataset for each query. So the dataset will contain multiple tables. Then I used the writeXMLschema on the dataset to get the layout of the XML for my dataset.
In this XML I do a copy of all datatable fields with their content and paste it in the XML of the xsd between the tags
<xs:choice maxOccurs=&quot;unbounded&quot;>
</xs:choice>
Now you can select the desired fields and drag them on your report.

Regarding to your problem that you don't understand the dataset part : you extract the data in vb.net into a dataset. This dataset is 'bound' to your crystal report by setting the datasource of the reportdocument. Your crystal report itself needs to 'understand' the xml you are giving it. That is where you use the dataset schema for (the xsd file). It is this xsd file which you need to select for the
&quot;add/remove database&quot; in the crystal report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top