Solved

Help with using Crystal Report with XML data source

Posted on 2010-09-03
13
738 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
ID: 33604571
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
ID: 33605191
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
ID: 33605457
How id you build the report?

Was it against the XML data source?

mlmcc
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:vcharles
ID: 33605493
Yes, data source is xml.
0
 
LVL 100

Expert Comment

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

mlmcc
0
 

Author Comment

by:vcharles
ID: 33607954
Against an XML (several xml files linked by one xml )
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 33608430
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
ID: 33608493
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
ID: 33608542
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
ID: 33608668
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
ID: 33611642
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
ID: 33621563
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
ID: 33742045
issue still not resolved, another approach will be followed
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 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