Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameter field

Status
Not open for further replies.

dasiga222

IS-IT--Management
Sep 22, 2003
68
US
Hi

I am using crystal reports 10
In the data expert section,
I am fetching the data from backend table
using a command

I need to fetch all the employees based on a divisioon number which I give as a parameter

The query which I am giving is

select * from emp where div_no = '{?div_no}'

where ?div_no is the parameter field

This works good div_no in database is a string field

But this query fails if the div_no in data base is number

I tried this query , but this is not working

select * from emp where div_no = {?div_no}

Can some one please help

Thanks

 
What does this query fails mean, you get an error? That's like saying my computer isn't working right...fix it.

What type of parameter did you define?

The data type in the database won't change from a number to a string or vice versa, your parameter should be defined as the same as your database uses.

Can't see why you need a Command object based on that query, just add the table in and use standard Crystal parameters.

-k
 
Thanks for your response
The div no earlier was a string
Now it is changed to number by the DBA for some reasons

Now can u suggest how can I modify my query in command ?
should it be still

select * from emp where div_no = '{?div_no}'


or should it be changed to

select * from emp where div_no = {?div_no}


thanks
 
I think that you just change your parameter type in the Command.

So select Dtaabase->Database Expert, right click the Command in the Selected Tables->Edit Command->Select the parameter and select Modify->Change the type to number.

-k
 
You need to change the datatype of the parameter from String to Number, then you command would be:

select * from emp where div_no = {?div_no}

... which incidentally should have worked even when div_no was a String.

-ave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top