Solved

Help with using Crystal Report with XML data source

Posted on 2010-09-03
13
745 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Check only one toolstripmenu item 12 63
Excel Web Add-in Where is Visual Basic used 9 84
Variable 'id' is used before it has been assigned a value 29 45
Adding Rows to Grid 4 34
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

759 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