User475983607 posted
Hi,
I have this SQL adapter taking an id from a previous page but i want to be able to sort it by the Year field any ideas?
New SqlDataAdapter(SELECT Artist_Code, Artist, Title, Album_Code, Year, Tracks FROM tbl_Artist_Albums WHERE (Length=1 OR Length=2) AND Artist_Code=" + _
Request.QueryString("id"), objConn)
What exactly is the problem? Is the a T-SQL syntax question?
"SELECT Artist_Code, Artist, Title, Album_Code, Year, Tracks FROM tbl_Artist_Albums WHERE (Length=1 OR Length=2) AND Artist_Code=" + _
Request.QueryString("id") + " ORDER BY Year"
https://www.w3schools.com/sql/sql_orderby.asp
Your code is susceptible to SQL injection. Consider writing a parameter query rather than using string concatenation.
https://forums.asp.net/t/1568268.aspx?SQL+Injection+And+Parameterized+Queries