Skip to Content
author's profile photo Former Member
Former Member

Doubt in Binding Table In asp.net Crysatk Report, how it work?

Hi u2026

Order Table

Order No Date Product Qty Customer

A101 10-Oct-2010 Mac Book 10 John

A102 10-Oct-2010 I-Phone 25 Smith

A103 10-Oct-2010 I-Pad 40 Kallis

Here Order No is primary key

Order Detail Table

Order No Date Product Qty Customer Batch No

A101 10-Oct-2010 Mac Book 03 John B01

A102 10-Oct-2010 I-Phone 05 Smith B02

A103 10-Oct-2010 I-Pad 10 Kallis B03

A101 10-Oct-2010 Mac Book 02 John B04

A102 10-Oct-2010 I-Phone 07 Smith B05

A103 10-Oct-2010 I-Pad 15 Kallis B06

Here Batch No is primary key

The above table is just a sample table.

I have more than 1000 Order in my table. And for each Order there are at least 12 Order Detail is available in my Order Detail Table. It uses to take long time on loading the report for the first time. So, I thought to select Top 20 records from Order table.

I have used the below query in crystal report command

Select Top 20 O.OrderNo, O.Product, O.Date, O.Qty from Order O

inner join Order Detail OD on O.OrderNo = OD.OrderNo

1. After execution of above query, I would like to know whether all the records from Order Detail Table will be checked during execution (OR) only matching Top 20 records of Order Table will be checked in Order Detail Table and executed?

2. How to use stored procedure in Crystal Report command?

3. What are the steps I need to take, to load Crystal report fast during first time page load?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 28, 2010 at 01:49 PM

    Well for the first question... Answer = NO.

    1) A top 20 query will simply show you the 1st 20 records that come up. In fact, unless you specify an order by clause, they may not even be the same 20 records each time you run it.

    2) You don't have any Order Detail fields in your SELECT statement, so what's the point in adding it to statement at all?

    If you want the "top 20" from the Order table and ALL of the corresponding Order Details, you'll need something like this...

    SELECT
    sq.*,
    od.Field1,
    od.Field2,
    od.Field3
    FROM (SELECT Top 20 O.OrderNo, O.Product, O.Date, O.Qty from Order AS O) AS sq
    INNER JOIN OrderDetail od on sq.OrderNo = od.OrderNo
    

    As for the 2nd question... How to use stored procedure in Crystal Report command? You use it the same way you would in SSMS. Same syntax.

    Command

    EXEC StoredProc ('{?TextParameter1}', {?NumericParameter})
    

    For the 3rd question, not sure what you mean. If you simply want the report to produce results quickly, write a clean query that executes quickly in SSMS. If, as Don suggests, you are trying to get CR to launch in an external app, then follow his advise and post in the .NET SDK Forum.

    HTH,

    Jason

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 28, 2010 at 01:15 PM

    Hello,

    Please ask one question per post, keeps it cleaner and easier to search.

    Not sure about #1, I have not tested this for long time.

    For #2 why not just add the SP in the Database Wizard? Test it, you'll see what the SQL is and then use it in your Command if you really want to do it that way. It's better and easier though to connect directly to the SP rather than going through a command object. Do EVERYTHING in the Store Procedure, DB Servers are much more efficient at filtering and collect data than CR ever will be.

    #3 Post your question to the [.NET SDK Forum|SAP Crystal Reports, version for Visual Studio;.

    Thank you

    Don

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.