Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9269

Re: Crystal Reports and Sql CE

$
0
0

Setting to XML was only a test to see if that worked.

 

SQL CE is not listed in our PAM so it's not supported to connect to it it directly through ODBC or OLE DB. But since you are using a dataset that doesn't matter.

 

If you copy the data from the DB outside of CR and then set the report to the Dataset at this point CR only sees the data and not where it came from:

 

// Engine

CrystalDecisions.CrystalReports.Engine.ReportObjects crReportObjects;

CrystalDecisions.CrystalReports.Engine.SubreportObject crSubreportObject;

CrystalDecisions.CrystalReports.Engine.ReportDocument crSubreportDocument;

CrystalDecisions.CrystalReports.Engine.Database crDatabase;

CrystalDecisions.CrystalReports.Engine.Tables crTables;

 

CrystalDecisions.Shared.TableLogOnInfo tLogonInfo;

 

btnSQLStatement.Text = "";

 

try

{

    foreach (CrystalDecisions.CrystalReports.Engine.Table rptTable in rpt.Database.Tables)

    {

        tLogonInfo = rptTable.LogOnInfo;

        tLogonInfo.ConnectionInfo.ServerName = btrDataFile.Text; // D:\Atest

        tLogonInfo.ConnectionInfo.DatabaseName = btrSearchPath.Text; //  UNTPR01.xml

        tLogonInfo.ConnectionInfo.UserID = "";

        tLogonInfo.ConnectionInfo.Password = "";

        tLogonInfo.TableName = rptTable.Name;

 

        dtStart = DateTime.Now;

 

        try

        {

            rptTable.ApplyLogOnInfo(tLogonInfo);

            rptTable.Location = btrDataFile.Text + "\\" + btrSearchPath.Text;

        }

        catch (Exception ex)

        {

            MessageBox.Show("ERROR: " + ex.Message);

            //return;

        }

 

        difference = DateTime.Now.Subtract(dtStart);

 

        btnSQLStatement.Text += /*rptTable.Name.ToString() +*/ " Set in " + difference.Minutes.ToString() + ":" + difference.Seconds.ToString() + ":" + difference.Milliseconds.ToString() + "\n";

 

    }

}

 

catch (Exception ex)

{

    MessageBox.Show("ERROR: " + ex.Message);

    //return;

}

 

Don


Viewing all articles
Browse latest Browse all 9269

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>