Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / January 2006

Tip: Looking for answers? Try searching our database.

How to create a dataset from XML for use in Crystal Reports

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kirk - 09 Jan 2006 20:49 GMT
Hello,

I have an app that reads & writes to XML files.  I now would like to
create some reports using Crystal Reports, and the usual way I do this
is by creating a dataset in Visual Studio & inserting the fields
graphically.  However, I cannot find out how to do this within the VS
IDE.  I can create the dataset programatically like this:

   Dim filePath As String = "C:\Temp\XMLfile.xml"

   AuthorsDataSet.ReadXml(filePath)

   DataGridView1.DataSource = AuthorsDataSet
   DataGridView1.DataMember = "authors"

...but this created at runtime, and as such, I cannot use it at
design-time for my CR design work.

How can I create a dataset from an XML file at design time?

Thanx in advance.
Elton W - 10 Jan 2006 02:29 GMT
Hi Kirk,

You don’t have to use Dataset to design your CR. You can use ttx file (field
definition file) as data schema to design the CR. And it’s very easy to use
even Notepat to create a ttx file.

HTH

Elton Wang

> Hello,
>
[quoted text clipped - 17 lines]
>
> Thanx in advance.
Kirk - 10 Jan 2006 20:49 GMT
Elton,

Thanks for your reply.  After some struggling, I was able to create a
ttx file to use as I am designing my report (thank you!).  However, I
am having a problem populating the report with data from my dataset.  I
use the same code as above, but after I populate my dataset, I do this:

  Dim crReport As New TcReport01
  crReport.SetDataSource(AuthorsDataSet) 'Set the data source for the
report
  CrystalReportViewer1.ReportSource = crReport 'Set the report to view

And all the report shows (in the detail section) is the default value
in my TTX file.  For example, my TTX file looks like this:

 ; Field definition file for table: ADORecordset
 Description    String    20    Default

But the the detail on the report always shows just "Default".  Can
anyone see where I am going wrong?

Thanks.
Elton W - 12 Jan 2006 03:28 GMT
Hi Kirk,

Two possible reasons:

1. The report might be in a Save Data with Report mode. It always shows data
in design time. You can open report in Seagate Report Designer. From Menu
File uncheck Save Data with Report, then save the report.

2. It’s better to use DataTable as report’s data source like following:

Report.Database.Tables[0].SetDataSource(datatable0);    
Report.Database.Tables[1].SetDataSource(datatable1);


HTH

Elton Wang

> Elton,
>
[quoted text clipped - 18 lines]
>
> Thanks.
Kirk - 12 Jan 2006 20:04 GMT
Elton,

Thanks for your great response.  I followed your second option and was
able to get my report to work!

I changed the code to this:

crReport.Database.Tables(0).SetDataSource(AuthorsDataSet.Tables(0))

...and it worked correctly.

Thanks for following up with me and getting me past this hurdle.  I
greatly appreciate your help!
Kirk
Elton W - 13 Jan 2006 19:00 GMT
I'm very glad that helped.

> Elton,
>
[quoted text clipped - 10 lines]
> greatly appreciate your help!
> Kirk

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.