Loading DBF from source code

Stimulsoft Reports.WEB discussion
Post Reply
petr.pavlis
Posts: 27
Joined: Sun May 15, 2011 4:16 am

Loading DBF from source code

Post 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
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Loading DBF from source code

Post by HighAley »

Hello.

Please, send us a sample DBF file for analysis.

Thank you.
petr.pavlis
Posts: 27
Joined: Sun May 15, 2011 4:16 am

Re: Loading DBF from source code

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Loading DBF from source code

Post 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.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: Loading DBF from source code

Post 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.
petr.pavlis
Posts: 27
Joined: Sun May 15, 2011 4:16 am

Re: Loading DBF from source code

Post by petr.pavlis »

Perfect, thank you!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Loading DBF from source code

Post by HighAley »

Hello, Petr.

We are always glad to help you.

Thank you.
Post Reply