Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 145
  • Last Modified:

Crystal report in SQL

i would like to print out the report according to the query below, the table name is "table", field is "id" and search for the word "test", if found then print out the report. but i've tried the following code it printed out all the report. why ?

CrystalReport1.SQLQuery = "SELECT * FROM table WHERE id = 'test'"
0
qazwsxedc
Asked:
qazwsxedc
  • 2
1 Solution
 
percosolatorCommented:
If you are still attaching to Access like in your last question, it won't work.  SQLQuery is for attaching to a SQL Server.

One alternative is to create a stored Access query with a parameter field to pass in.


0
 
qazwsxedcAuthor Commented:
you meant SQLquery just for SQLserver usage ? if then how the alternative ways work that you talking about ?
0
 
percosolatorCommented:
don't know if it's only MS SQL server, probably not, more than likely it will work with another SQL server, Oracle or some other.

If you know how to create an Access query, you can do several things:  create the query to show all of the critical fields and attach Crystal to that query, and then pass a filter to crystal using the filter property like I showed you in the other question (which is probably your best route, since it's simplest)

Or create a temporary table in Access, create two action queries (one to delete all records in the table, and the other to populate the table with your desired data by passing a parameter to it) and linking crystal to that temporary table.  This method is more involved and has more steps, but is quicker to generate the report and depends on what, exacltly you are doing, how many stages the data has to go through, and (of course) how many records you are dealing with.

If you aren't talking 1000's of records, or your data doesn't have to be staged, or transformed, then I would recommend the first method.

P.S.  How do you pronounce "qazwsxedc"?  Thought mine was bad <g>.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now