Page 1 of 1

Loading DBF from source code

Posted: Mon Jun 24, 2013 6:39 am
by petr.pavlis
Hello,

I try to work with DBF in my report. Everything is OK, if I create report via Designer. But I have problem with loading the file from source code.

My source code:

Code: Select all

StiReport report = new StiReport();
StiDBaseSource db = new StiDBaseSource(@"C:\ZACI.DBF", "Zaci", "Zaci", 1250);
db.FillColumns();
report.Dictionary.DataSources.Add(db);
report.Dictionary.Synchronize();
…
But it doesn’t work and a FillColumns method throw NullReferenceException.

Pleas, help me solve my problem.

Thank you,

Petr

Re: Loading DBF from source code

Posted: Mon Jun 24, 2013 2:06 pm
by HighAley
Hello.

Please, send us a sample DBF file for analysis.

Thank you.

Re: Loading DBF from source code

Posted: Tue Jun 25, 2013 5:40 am
by petr.pavlis
Hello,

I have files for you -
Zaci.zip
(10.47 KiB) Downloaded 301 times
. But the problem is not connected only with this DBF file. I thing that I do something wrong.

Thank you.

Re: Loading DBF from source code

Posted: Thu Jun 27, 2013 10:27 am
by HighAley
Hello.

We have reproduced your issue.
We need some time to solve it.
we will let you know about the results.

Thank you.

Re: Loading DBF from source code

Posted: Fri Jun 28, 2013 9:44 pm
by Ivan
Hello,
petr.pavlis wrote:I try to work with DBF in my report. Everything is OK, if I create report via Designer. But I have problem with loading the file from source code.
My source code:

But it doesn’t work and a FillColumns method throw NullReferenceException.
Please modify your code:

Code: Select all

            StiReport report = new StiReport();
            StiDBaseSource db = new StiDBaseSource("ZACI.DBF", "Zaci", "Zaci", 1250);
            report.Dictionary.DataSources.Add(db);
            report.Dictionary.SynchronizeColumns(null, db);
            report.Dictionary.Synchronize();
Thank you.

Re: Loading DBF from source code

Posted: Wed Jul 03, 2013 2:32 pm
by petr.pavlis
Perfect, thank you!

Re: Loading DBF from source code

Posted: Thu Jul 04, 2013 8:49 am
by HighAley
Hello, Petr.

We are always glad to help you.

Thank you.