c# - Concat Order-By string in sql dynamically -



c# - Concat Order-By string in sql dynamically -

i seek alter wpf grid way, sorting in grid generate new sql-statement, should executed.

a simple way is, surround statement subselect , append order-by @ end, this:

select * (select * customertable) _orderby order customernr

does know improve solution problem, because creating subselections should not best way.

my thought was, observe if there existing order-by , append additional columns... not find stable way...

thank you!

ok, solved problem this:

i extemded sql-code own tag, order-by looks this:

[order-by] order mycolumn asc [/order-by]

if there no [order-by] in sql-code, utilize sold technique:

select * (select * customertable) _orderby order customernr

if there [order-by], remove every thing between: [order-by] , [/order-by] , create own order statement:

select * customertable [order-by] order customernr desc [/order-by]

will be

select * customertable order customername, customerlastname

maybe help 1 else.

c# sybase sqlanywhere

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -