0

I'm trying to set the order by direction (ASC or DESC) by using SelectParameters and I get this error:

Incorrect syntax near '@LicenseStatusSortOrder'.

When I replace @LicenseStatusSortOrder with ASC or DESC then it works. The Label_LicenseStatusSortOrder.Text does indeed contain either ASC or DESC so the value is present. See code below and thanks!

SelectCommand:

SelectCommand="SELECT SoftwareLicense.Name, SoftwareLicenseByApplication.ComplianceStatus FROM UserInfo ORDER BY SoftwareLicenseByApplication.ComplianceStatus @LicenseStatusSortOrder"

SelectParameter:

> <asp:ControlParameter ControlID="Label_LicenseStatusSortOrder"
> DefaultValue="ASC"  Name="LicenseStatusSortOrder"
> PropertyName="Text"/> 

--Clark Bohs

Clark Bohs
  • 11
  • 3
  • I know of no SQL database that will let you parameterize parts of the query instead of just the actual parameters. – Joachim Isaksson Oct 28 '13 at 17:26
  • Thanks Joachim. I was hoping there would be a way to swap in ASC or DESC to the SelectCommand. It seems like the type of thing that developers would want to configure dynamically rather than creating a new SQLDataSource for each sort order direction. – Clark Bohs Oct 28 '13 at 20:25

0 Answers0