victor2010
Programmer
Hello,
I'm using XML as a data source for my report, the report works ok by itself, however when attempting to run it using VB.Net, I receive a prompt for login and password, problem is the xml files are not password protected, seems like it can't find the xml files, please help me fix this problem. I am using Crystal Repory XI Release 2 with VS 2008.
Below is my code, and example of the content of the xml files. I am selecing the receiver/Donor nations' ID from a grid and copying it to textbox2, the code was simplified to focus on the problem.
1. Doner.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root xmlns:xsi=" <Row>
<Donor_ID>1</Donor_ID>
<Donor>BEL</Donor>
</Row>
<Row>
<Donor_ID>2</Donor_ID>
<Donor>CAN</Donor>
</Row>
</Root>
2. Receiver.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root xmlns:xsi=" <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>
3. Link.xml
<?xml version="1.0" standalone="yes"?>
<DocumentElement>
<Row>
<Link_ID>1</Link_ID>
<Receiver_ID>1</Receiver_ID>
<Donor_ID>1</Donor_ID>
</Row>
<Row>
<Link_ID>2</Link_ID>
<Receiver_ID>2</Receiver_ID>
<Donor_ID>1</Donor_ID>
</Row>
</DocumentElement>
Thanks,
4. Code
Imports System.Xml.Linq
Imports System.Data.OleDb
Imports Microsoft.VisualBasic.ControlChars
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.CenterToScreen()
End Sub
Private Sub Button6_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim myviewer As New AOP29VIEWER
Dim myreport As New AOP29_XML
Dim SearchCriteria As String
SearchCriteria = "{Link.Receiver_ID} in [" & TextBox2.Text & "] "
myreport.RecordSelectionFormula = SearchCriteria
MsgBox(myreport.RecordSelectionFormula)
Me.Visible = False
With myviewer
.CrystalViewer1.ReportSource = myreport
.ShowIcon = False
.Show()
End With
Me.Cursor = Cursors.Default
myreport = Nothing
End Sub
Thanks
Victor
I'm using XML as a data source for my report, the report works ok by itself, however when attempting to run it using VB.Net, I receive a prompt for login and password, problem is the xml files are not password protected, seems like it can't find the xml files, please help me fix this problem. I am using Crystal Repory XI Release 2 with VS 2008.
Below is my code, and example of the content of the xml files. I am selecing the receiver/Donor nations' ID from a grid and copying it to textbox2, the code was simplified to focus on the problem.
1. Doner.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root xmlns:xsi=" <Row>
<Donor_ID>1</Donor_ID>
<Donor>BEL</Donor>
</Row>
<Row>
<Donor_ID>2</Donor_ID>
<Donor>CAN</Donor>
</Row>
</Root>
2. Receiver.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root xmlns:xsi=" <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>
3. Link.xml
<?xml version="1.0" standalone="yes"?>
<DocumentElement>
<Row>
<Link_ID>1</Link_ID>
<Receiver_ID>1</Receiver_ID>
<Donor_ID>1</Donor_ID>
</Row>
<Row>
<Link_ID>2</Link_ID>
<Receiver_ID>2</Receiver_ID>
<Donor_ID>1</Donor_ID>
</Row>
</DocumentElement>
Thanks,
4. Code
Imports System.Xml.Linq
Imports System.Data.OleDb
Imports Microsoft.VisualBasic.ControlChars
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.CenterToScreen()
End Sub
Private Sub Button6_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim myviewer As New AOP29VIEWER
Dim myreport As New AOP29_XML
Dim SearchCriteria As String
SearchCriteria = "{Link.Receiver_ID} in [" & TextBox2.Text & "] "
myreport.RecordSelectionFormula = SearchCriteria
MsgBox(myreport.RecordSelectionFormula)
Me.Visible = False
With myviewer
.CrystalViewer1.ReportSource = myreport
.ShowIcon = False
.Show()
End With
Me.Cursor = Cursors.Default
myreport = Nothing
End Sub
Thanks
Victor