Share via


CDaoRecordset::GetSQL

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

CString GetSQL( ) const;

Return Value

A CString that contains the SQL statement.

Remarks

This will generally be a SQL SELECT statement.

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, and what you may have specified in the m_strFilter and m_strSort data members.

Note

Call this member function only after calling Open.

For related information, see the topic "SQL Property" in DAO Help.

Requirements

Header: afxdao.h

See Also

Reference

CDaoRecordset Class

Hierarchy Chart

CDaoRecordset::GetDefaultSQL

CDaoRecordset::GetDefaultDBName

CDaoRecordset::GetName

CDaoRecordset::GetType

Other Resources

CDaoRecordset Members