while calling a crystal report from c# code if i need to change the query according to criteria selected how could i do that...plz if any one could help
Printable View
while calling a crystal report from c# code if i need to change the query according to criteria selected how could i do that...plz if any one could help
Create a parameter in your crystal reports and in your code pass a value to it.
Sorry I can't give you the code I don't have VS in this pc. Try to search here or in vb.net section surely you can find a lot of it and it can easily be converted to c# code.
You just put the options on ur form
1 sort by name
2 sort by amt
3 sort by other
now just do that put a paramaeter in stored procedure
and by passing the parameter in stored proc just put the conditions on the store procedure like
create proc getresults sorting varchar(1) as
if sorting='1' then
begin
whole query +
order by name
end
if sorting='2' then
begin
whole query
order by amt
..
and by this way u can get ur requried result , i hope so