Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Nested SQL assigned to Database Post Reply Post New Topic
Author Message
Razzy
Newbie
Newbie
Avatar

Joined: 14 Oct 2009
Online Status: Offline
Posts: 6
Quote Razzy Replybullet Topic: Nested SQL assigned to Database
     Posted: 18 May 2010 at 9:37am
I have a 4 tier nested SQL statement that is being created in a VB.NET application.  The Query contains different 'Where' statements based on the item selected on the VB form. 
 
I would normally use Parameters and pass those into the report but in this case, the data filters (where statements) are in the nexted SQL statements and not in the top level statement.
 
I need to set the SQL statement as a Command selection within the Database configuration of the Crystal Report (using CR 2008). 
 
How do I pass in the SQL statement into a Crystal Report and set it as the Database source for the report data?
Razzy

"Artificial Intelligence is no match for Natural Stupidity"
Harold Green
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 May 2010 at 2:45am
in your vb.net app, create the report and then set the datasource to the dataset returned from the app.  You will need to tell the report that the datasource is ado.net as you are pushing the data to the report instead of pulling it, but in the end, it is way more flexible than pulling.
 
HTH
IP IP Logged
Razzy
Newbie
Newbie
Avatar

Joined: 14 Oct 2009
Online Status: Offline
Posts: 6
Quote Razzy Replybullet Posted: 25 May 2010 at 2:53am

Thank you for that information.

Do you happen to have an example of the vb.net code that would be used to push the sql statement?
 
Also, is it possible to push data to a sub-report?
Razzy

"Artificial Intelligence is no match for Natural Stupidity"
Harold Green
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 May 2010 at 2:59am
actually, this appears to be the correct syntax etc
 
I am not sure about subreports...well, if you define the datasource as the same as the main report, then it works, I don't know about separate datasources as I have never used them....and I very rarely use subreports.
 
HTH
IP IP Logged
Razzy
Newbie
Newbie
Avatar

Joined: 14 Oct 2009
Online Status: Offline
Posts: 6
Quote Razzy Replybullet Posted: 25 May 2010 at 3:03am

Thank you.

Razzy

"Artificial Intelligence is no match for Natural Stupidity"
Harold Green
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum