Solved

Help with using Crystal Report with XML data source

Posted on 2010-09-03
13
734 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
 

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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

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.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

910 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

21 Experts available now in Live!

Get 1:1 Help Now