0

I have a MySQL stored procedure generating a resultset. The query uses GROUP_CONCAT to select rows as columns.

SQL Code snippet

SELECT CONCAT(
 ' SELECT MDE_ID, MDE_CreatedOn, MDE_LastEditedOn '

,  GROUP_CONCAT(CONCAT(
   ' ,t', MDF_ID, '.MDEMDF_Value AS `', REPLACE(MDF_Label, '`', '``'), '`'
   ) SEPARATOR ' ')

Following, I want to sort the recordset on a column.

SQL = "CALL moduleentry_select(" & prjid & ",0,26,0)"
set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.LockType = 3
rs.Open SQL, Conn
rs.Sort = "volgnummer"

I have verified and the column is in the recordset.

I get the following error:

Microsoft Cursor Engine error '80040e04'
Row handle is invalid.
default.asp, line 176

Line 176 is rs.Sort = "volgnummer"

edit

The column 'Volgnummer' doesn't actually exist in the database. It is selected dynamically via a pivoting principle, using GROUP_CONCAT. Referring to this SA answer: joined table rows into columns with column titles from original rows

Community
  • 1
  • 1
Steven Ryssaert
  • 1,989
  • 15
  • 25

0 Answers0