Last post Jul 05, 2012 01:01 PM by jumojer
Jul 04, 2012 04:13 PM|jumojer|LINK
Hi everybody, I have a problem with one of my dataset's function. I used this function as the selectMethod for my gridview's objectDataSource
This resquest is build like this :
Select column1, column2 From dataTable Where (column1 = ?)m Order BY ?
and then I add the parameters with the <selectParameters> tag of my object data source and but the values dynamicly in the code behind
the only thing is that the ORDER BY ? does no works with a parameter but as soon as I do this ORDER BY column1
it works.. Why does the 'order by' statement work in that case and not the other?
Jul 04, 2012 05:14 PM|TonyDong|LINK
You have to hard code order by.
You can try this
select * from table order by case @parameter when 'Column1' then Column1 when 'Column2' then Column2 end ASC
Jul 05, 2012 08:47 AM|jumojer|LINK
I am working with an access database and when I build the request in access it does not work with the CASE ...WHEN syntaxe
will I have the same problem when the request will be done in my app's code (dataSet Table adapter function)?
Jul 05, 2012 12:21 PM|TonyDong|LINK
MS Access is different with ms SQL, please see this url for how to use case like statement.
Jul 05, 2012 01:01 PM|jumojer|LINK