CRecordset::GetSQL

Call this member function to get the SQL statement that was used to select the recordset's records when it was opened.

const CString& GetSQL( ) const;

Return Value

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

Remarks

This will generally be a 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).

备注

Call this member function only after calling Open.

Requirements

Header: afxdb.h

See Also

Reference

CRecordset Class

Hierarchy Chart

CRecordset::GetDefaultSQL

CRecordset::Open

CRecordset::m_strFilter

CRecordset::m_strSort

Other Resources

CRecordset Members