Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL AND CRYSAL REPORT

Author  Topic 

azim
Starting Member

29 Posts

Posted - 2002-02-23 : 14:24:14
SQL="select * from absentees where studentid like '" val(text.text)"' and date like '"val(text2.text)"' and year like '" val(text3.text)"'"

HOW I CAN WRITE THIS WITH CRYSTAL REPORT CODE
BUT WITHOUT CRYSTALREPORT1.SQLQUERY BECAUSE IT'S SLOW

azim

andre
Constraint Violating Yak Guru

259 Posts

Posted - 2002-02-25 : 10:05:20
I've never used Crystal Reports. However, from a SQL Server perspective, I suggest using stored procedures since they can speed up queries. In your case:




CREATE PROCEDURE sp1 (
t1 varchar(50),
t2 varchar(50),
t3 varchar(50)
) AS

SET NOCOUNT ON

select * from absentees where studentid like t1+'%' and date like t2+'%' and year like t3+'%';

SET NOCOUNT OFF


Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-02-25 : 10:19:08
you can go to Crystal Reports Menu
Reports-> Edit Selection Formula->Record

Type this
{absentees.studentlike}>={@fromno} and {absentees.studentlike}<={@tono}

Dont forget to create formula fields @fromno,@tono in your report

and pass the values thru VB using
Form1.CrystalReport1.Formulas(0) = "@fromdate= " & val(text1.text)
Form1.CrystalReport1.Formulas(1) = val(text2.text)


but i would follow andre's suggestion.

HTH


--------------------------------------------------------------


Edited by - Nazim on 02/25/2002 23:23:25
Go to Top of Page
   

- Advertisement -