[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Binding a dataset to crystal report at run time - vb.net ms access

Posted on 2006-05-08
Medium Priority
Last Modified: 2012-06-27
EE Team,

I have vb.net code where in i define the sql with where condition based on certain user selection criteria.


ReportDS = Select * from employee where emp_id = combobox1.selectedvalue and emp_name ='abc'

The sql works fine. I create a dataset of the result set return from this query.

My table has 100 records, based on this query i should get 10 records.

Now. i use something lise this

        Dim DocReport As New DoctorReport
        Me.CrystalReportViewer1.ReportSource = DocReport

The crystal report viewer displays all 100 records.

While create the crystal report thru wizard.

I select  

 oble db , jet engine 4 ..

 then i point it to my mdb file, then i add my required table.

 then i select only particular fields which i require.

 no other selection.

 i just want to show report based on my dataset. but what is actually happening is its not considering my dataset and i just displaying all records.

plzz help me in my logic or the way it should be done..

Question by:Apu_Shah
  • 4
  • 3
LVL 70

Accepted Solution

Éric Moreau earned 1500 total points
ID: 16637789
Hi Apu_Shah,

see "Reporting Off ADO.NET Datasets" from http://www.businessobjects.com/products/dev_zone/net_walkthroughs.asp


Author Comment

ID: 16638725
The only difference between the example shown and what i have done is.

I am creating dataset during runtime based on my sql.

and the Example shown, create a seperate dataset1 in the project as well as in the vb.net code.

I dont know why do we need to do it two times.

Plz, explain me the concept.

Thanks for your reply.

LVL 70

Expert Comment

by:Éric Moreau
ID: 16642637
but when you designed your report, have you bound it to the database or on a XML schema?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 16644429
when i defined the report i did bound to database.

I did, ADODB connection where it asked me for the mdb file. i mentioned that, then i have also mentioned the table and the required fields.

plz help me in this, its a high priority for me.

LVL 70

Expert Comment

by:Éric Moreau
ID: 16644627
>>when i defined the report i did bound to database.

That's the problem. You need to bind it to XML schema.


Author Comment

ID: 16644830
i am sure , why its not working for me

i used write xml command , also i have a xsd defined. this xsd has one table.

but when i use the field explorer and, more data source .. and add xsd., the xsd doesnt show any fields that i can use to select.

plz let me know some easy steps to do this.

I am new to CR. so plz help me


Author Comment

ID: 16644959

I got it worked, i used report . RecordSelectionFormula

this works like a charm. not xsd not xml..

works great.

Thanks for your help....

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question