Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: SQLCode: 42S22 --Invalid Column Name Post Reply Post New Topic
Author Message
siva21
Newbie
Newbie
Avatar

Joined: 09 Jul 2009
Location: India
Online Status: Offline
Posts: 11
Quote siva21 Replybullet Topic: SQLCode: 42S22 --Invalid Column Name
     Posted: 18 Sep 2009 at 5:50am
I entered the following query in the CRystal reports X1 command box
q is a String paramter and entered y as input (connecting to SQL Server DB)
 
if({?q}='g')
begin
select * from bhplane
end
 
It replies with 'y' is a  invalid column name.when i checked the 'allow multiple value' checkbox of the parameter it works fine.but i actually need to uncheck it.i also tried using SET QUOTED_IDENTIFIER OFF but is does not work.i tried a combn of double quotes and single quotes but still not workin
.is there a soln for this
 


Edited by siva21 - 18 Sep 2009 at 5:54am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 Sep 2009 at 6:19am
If I understand correctly, you are using the Add Command from the datasource and then typing the entry.
 
As I understand the Command, and no one has told me I am wrong, it is designed to gather information for the parameter list.  Asking it to look at the parameter and do something is backwards and is always asking for trouble.
 
what do the users select if the parameter is not 'g'?  Crystal is not that complex nor that intelligent, if you have a parameter (or this your method to get data for the report?) crystal is going to want to have it filled in to pass along to the stored proc or the filter.
 
As much as anything, what is the purpose of the code?  To get information for a parameter, to be a parameter, or to get data for the report?
 
 
IP IP Logged
siva21
Newbie
Newbie
Avatar

Joined: 09 Jul 2009
Location: India
Online Status: Offline
Posts: 11
Quote siva21 Replybullet Posted: 18 Sep 2009 at 6:49am
Thasts correct i am using the Add command from the datasource.....
my point being that  the same if condition works for a number parameter or a multiple value string parameter but not for a single value string parameter.....
 
actually the code i posted here was just a synopsis of what i am goin to design in future..........
 
 
will tell you the actual.i would add one parameter value as default like 'g ' and if the user selects g i would retrieve data from one database else from some other database (linked servers i mean).i dont want to use SP or stor proc
 
i implemented the same using a number parameter eg.if 1 is entered then select from swiss db else from german db.but the requirements needs to enter G or S


Edited by siva21 - 18 Sep 2009 at 6:51am
IP IP Logged
siva21
Newbie
Newbie
Avatar

Joined: 09 Jul 2009
Location: India
Online Status: Offline
Posts: 11
Quote siva21 Replybullet Posted: 18 Sep 2009 at 8:10am
GOT the SOLUTION!
 
just put single quotes around the paramter
 
if('{?q}'='g')
begin
select * from bhplane
end
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