cancel
Showing results for 
Search instead for 
Did you mean: 

VB.NET2010, MySQL and Crystal Report XML Datasource Deployment Problem

Former Member
0 Kudos

Hi, everyone

Im using VB.NET 2010 and MySQL. I have created reports using XML as datasource. I didn't have problems during the development, all seems to work fine.
My problem is whenever I copy the exe file from the "bin" folder of my project and try to run it outside(ex: desktop), it can no longer generate the exact report.

The same is true when I create a deployment setup and try to install it.
This doesn't works even though I'm still using the DEV pc.

I think it cannot generate an exact report when it is not in the "bin" or project location.

Here is the code I got from youtube in creating xml file to be used in creating reports. The code creates an xml file where the reports based its data/content. The xml files are created just where the exe file is located.

Dim ds As New DataSet

Dim cs As New MySqlConnection(connStr)

Dim da As New MySqlDataAdapter

    sql = "SELECT * . . . . "

    Try

        cs.Open()

        da.SelectCommand = New MySqlCommand(sql, cs)

        da.Fill(ds)

        ds.WriteXml(CurDir() & "\reportFile.xml", XmlWriteMode.WriteSchema)

    Catch ex As Exception

        MsgBox(ex.Message)

    End Try

I hope I can get any help or suggestions.

Thank you so much.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Sounds like you are manually deploying CR runtime. Please search on how to deploy runtime, lot's of post in this forum.

Don

Former Member
0 Kudos

Thanks for the reply sir Don, I think I should set the datasource to its current directory upon loading. Im now searching how.

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

Can you please expand on:


I think it cannot generate an exact report

What does that mean?

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

Sir @Ludek, it doesn't point to the XML file in its current directory. It points to the original project location that's why It doesn't generate the expected result. I think I have to change the location of the datasource programatically or upon loading.

0 Kudos

Your code simply saves the xml file but it does update the report to use the xml file just saved.

Add this:

...

        ds.WriteXml(CurDir() & "\reportFile.xml", XmlWriteMode.WriteSchema)

        rpt.SetDataSource(ds)

    Catch ex As Exception

        MsgBox(ex.Message)

    End Try

You may have to add in a rpt.VerifyDatabase to confirm the DS matches the reprot exactly.

Don

Former Member
0 Kudos

Hi I'm sorry for the late reply. How will I declare the "rpt"?

By the way what I did was I saved the xml files to a folder in C: so that all of the xml's will be generated and read in this directory.

Thank you for the reply.

0 Kudos

ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();