GetDSbySQL Method
- Last UpdatedNov 06, 2025
- 1 minute read
The GetDSbySQL() method retrieves a new DataSet based on the SQL statement passed as a parameter. The SQL statement must be a single SELECT statement.
Parameters
- sessionId
- Optional. Holds the session ID and thus the user who is making this method call.
- sql
- Required. Holds the SQL SELECT statement to execute.
Return Value
Returns a DataSet based on the supplied SQL statement.
Prior to MES 2017, any SQL statement could be passed as a parameter to this method. With MES 2017 and later, any call not using a single SELECT statement will result in the error "Invalid SQL statement caught by Middleware."
To call a custom stored procedure, use the ExecSp() or GetDsBySp() method in the Core.DirectAccess class.