CRecordset::GetSQL

const CString& GetSQL( ) const;

Return Value

A const reference to a CString that contains the SQL statement.

Remarks

Call this member function to get the SQL statement that was used to select the recordset’s records when it was opened. This will generally be an SQL SELECT statement. The string returned by GetSQL is read-only.

The string returned by GetSQL is typically different from any string you may have passed to the recordset in the lpszSQL parameter to the Open member function. This is because the recordset constructs a full SQL statement based on what you passed to Open, what you specified with ClassWizard, what you may have specified in the m_strFilter and m_strSort data members, and any parameters you may have specified. For details about how the recordset constructs this SQL statement, see the article Recordset: How Recordsets Select Records (ODBC) in Visual C++ Programmer’s Guide.

Important   Call this member function only after calling Open.

CRecordset OverviewClass MembersHierarchy Chart

See Also   CRecordset::GetDefaultSQL, CRecordset::Open, CRecordset::m_strFilter, CRecordset::m_strSort