简体   繁体   中英

How to display the data on a crystal report viewer with a report that either has stored procedure or sql query using vb.net 2008

I have a bunch of mix reports that has either one of it is using Stored procedure or SQL query. I was able to display the data on the report viewer that uses SQL Query but I cannot display the data of the report that uses stored procedure. What is the best approach for this?

Please advice thanks.

You can use the EXEC call in a command and Crystal will parse out the result for you.

EXEC procThatReturnsRecords 'parm1(string)',param2(number)

You need to be careful and test for conditions in your proc where the parameters come in blank and make sure to always return something for crystal to look at for a schema. I was puzzled once by a command that had an if statement in it that simply did nothing if the parameters came in blank. I had to add and else statement that selected all the fields from the table where 1 = 0. That was a frustrating bug to find.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM