Solved

Help with using Crystal Report with XML data source

Posted on 2010-09-03
13
730 Views
Last Modified: 2012-06-21
Hello,

I'm gettimg prompted for a password eventhough my XML datasource is not password protected.  Can you help me fix this problem? The code below is what I've tried, but it still doesn't work. I'm using VB.NET with crystal report 2008.

Thanks,

V.

Dim xyzcal As String
        xyzcal = Trim(TextBox1.Text)
        Dim myaop29report As New AOP29_XML
        Dim myaop6viewer As New AOP6VIEWER
        Dim mySQL_Statement As String

        Dim fs1 As System.IO.FileStream
        fs1 = New System.IO.FileStream(Application.StartupPath + "\Link.xml", IO.FileMode.Open)
        mySQL_Statement = "{Link.Receiver_ID}in [" & xyzcal & "]"
        Dim myDataAdapter As New Xml.XmlTextReader(fs1)
        Dim dtset1 As New DataSet
        dtset1.ReadXml(fs1)
        myaop29report.SetDataSource(dtset1)
        myaop29report.SetDatabaseLogon("admin", "")
        With myaop6viewer
            .CrystalViewer1.ReportSource = myaop29report
            myaop29report.RecordSelectionFormula = mySQL_Statement
            .Show()
        End With
        MsgBox(myaop29report.RecordSelectionFormula)
        Me.Cursor = Cursors.Default
        myaop29report = Nothing
0
Comment
Question by:vcharles
  • 7
  • 5
13 Comments
 
LVL 4

Expert Comment

by:TomLaw1999
Comment Utility
Is this where the problem is occurring?:
myaop29report.SetDatabaseLogon("admin", "")

If so try sending a dummy password i.e.:
myaop29report.SetDatabaseLogon("admin", "Dummy")

Havent tested this but worth a try.
0
 

Author Comment

by:vcharles
Comment Utility
No, that is not the Location. I don't get an error message, just a prompt for login data. Dummy did not work. Do you have another suggestion?

0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
How id you build the report?

Was it against the XML data source?

mlmcc
0
 

Author Comment

by:vcharles
Comment Utility
Yes, data source is xml.
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
When you created the report, did you do so against an XML file or against a database?

mlmcc
0
 

Author Comment

by:vcharles
Comment Utility
Against an XML (several xml files linked by one xml )
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
Comment Utility
I have built many reports against XML files but they were always run against an XML file not a dataset.

DOes this idea help any
http://www.emoreau.com/Entries/Articles/2006/09/Feeding-Crystal-Reports-from-your-application.aspx

mlmcc
0
 

Author Comment

by:vcharles
Comment Utility
Thanks for the source code, the source of my report is .xml instead of .xsd, could that be the problem?
0
 

Author Comment

by:vcharles
Comment Utility
Hi,

Below is an example of the data source (Three xml files, donor.xml and receiver.xml are linked by link.xml) The report displays the values of Domors and recivers based on their id field in the link file.
The report works alone, but doesn't work with vb.net. Is something wrong with the files' format for .net?

Donor:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <Row>
            <Donor_ID>1</Donor_ID>
            <Donor>BEL</Donor>
      </Row>
      <Row>
            <Donor_ID>2</Donor_ID>
            <Donor>CAN</Donor>
      </Row>
      <Row>
            <Donor_ID>3</Donor_ID>
            <Donor>CZE</Donor>
      </Row>
      <Row>
            <Donor_ID>4</Donor_ID>
            <Donor>DNK</Donor>
      </Row>
      <Row>
            <Donor_ID>5</Donor_ID>
            <Donor>USA</Donor>
      </Row>
</Root>

Link.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <Row>
            <Receiver_ID>1</Receiver_ID>
            <Donor_ID>2</Donor_ID>
            
      </Row>
      <Row
            <Receiver_ID>3</Receiver_ID>
            <Donor_ID>4</Donor_ID>
      </Row>
</Root>


Receiver:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <Row>
            <Receiver_ID>1</Receiver_ID>
            <Receiver>FRA</Receiver>
      </Row>
      <Row>
            <Receiver_ID>2</Receiver_ID>
            <Receiver>GBR</Receiver>
      </Row>
      <Row>
            <Receiver_ID>3</Receiver_ID>
            <Receiver>NLD</Receiver>
      </Row>
      <Row>
            <Receiver_ID>4</Receiver_ID>
            <Receiver>DEU</Receiver>
      </Row>
      <Row>
            <Receiver_ID>5</Receiver_ID>
            <Receiver>USA</Receiver>
      </Row>
</Root>
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Most XML files also include the data whereas the XSD is only the database definition.

I think that is the issue.  You want to build th ereport against the data definition then pass it the dataset.  That said, I am not sure there is much difference in using the XML file rather than simply the XSD.

mlmcc
0
 

Author Comment

by:vcharles
Comment Utility
Hello,
How do you obtain an xsd from an xml? How do you design the report with the xsd? and how do you pass the data using a dataset to the xsd?
Thanks,
V.
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 500 total points
Comment Utility
I think the example linked above shows how to use the XSD file.

I don't know how to build an XSD file.

mlmcc
0
 

Author Closing Comment

by:vcharles
Comment Utility
issue still not resolved, another approach will be followed
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now