Hello people, I am new to crystal report. Normally, I would insert columns in the crystal report viewer and then look at the records at the Main Report Viewer. All the rows/records in that particular columns of that table will be shown.

And then I found out about this SQL Command Query which can be used in the Database Expert of VS 2008. Now I can have a table that selects rows in my own choosing. Example, I can select records of people who have inactive accounts on the system.

SELECT * FROM PeopleTBL WHERE Status = 'Inactive'

All the records who have a Status = 'Inactive' will be populated.

Is there any way that this can be simply done through coding? Like creating an SQL Command Query in a single click of a button?

The problem that I have is with the Date Time Picker. As soon as I have selected the specific date, I want to see a crystal report based on that very date specified. Can I SELECT statments on my own preferences through coding?

I am sorry if you did not get it clearly. I am willing to elaborate more and maybe post pictures if possible.

thank you.

Recommended Answers

All 3 Replies

Of course you can do it in your program, there are lots of tutorials thatg show how to connect to a database and run sql commands. Here is a small list of them.

In the case of the DateTime picker, there should be an OnClick event in which you put the code to query the database.

You can also specify parameters on CR and filter your results with that, directly in the report.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.