Inspecting the SQL Statement BEFORE it executes on the Server 
Author Message
 Inspecting the SQL Statement BEFORE it executes on the Server

Hi,

Background:
-MFC
-ODBC

How can I see the SQL string that is being passed to the database server
before it is executed on the server.

For example

CRecordSet::Open() executes some SQL "under the hood"... however, it
constructs this according to the filter, the sort by, and if the class is
using paramters.

Can you tell me the line in the MFC source that holds the exact SQL
statement that is used?

Thanks
-Chris



Sat, 26 Jul 2003 05:18:03 GMT  
 Inspecting the SQL Statement BEFORE it executes on the Server

Quote:

> Hi,

> Background:
> -MFC
> -ODBC

> How can I see the SQL string that is being passed to the database server
> before it is executed on the server.

> For example

> CRecordSet::Open() executes some SQL "under the hood"... however, it
> constructs this according to the filter, the sort by, and if the class is
> using paramters.

> Can you tell me the line in the MFC source that holds the exact SQL
> statement that is used?

> Thanks
> -Chris

Call CRecordset::GetSQL()

--
Scott McPhillips [VC++ MVP]



Sat, 26 Jul 2003 10:32:33 GMT  
 Inspecting the SQL Statement BEFORE it executes on the Server
Scott,

Your suggestion causes a Database eception to call this before "opening" the
recordset:

For example:
 CRSPQAgent *pQuery = NULL;
 pQuery = new CRSPQAgent(&m_database);

 CString str = pQuery->GetSQL(); //exception caused

I want to be able to see the SQL *before* opening the bay boy.

Thanks.
-Chris


Quote:

> > Hi,

> > Background:
> > -MFC
> > -ODBC

> > How can I see the SQL string that is being passed to the database server
> > before it is executed on the server.

> > For example

> > CRecordSet::Open() executes some SQL "under the hood"... however, it
> > constructs this according to the filter, the sort by, and if the class
is
> > using paramters.

> > Can you tell me the line in the MFC source that holds the exact SQL
> > statement that is used?

> > Thanks
> > -Chris

> Call CRecordset::GetSQL()

> --
> Scott McPhillips [VC++ MVP]



Mon, 28 Jul 2003 02:15:57 GMT  
 Inspecting the SQL Statement BEFORE it executes on the Server

Quote:

> Scott,

> Your suggestion causes a Database eception to call this before "opening" the
> recordset:

> For example:
>  CRSPQAgent *pQuery = NULL;
>  pQuery = new CRSPQAgent(&m_database);

>  CString str = pQuery->GetSQL(); //exception caused

> I want to be able to see the SQL *before* opening the bay boy.

> Thanks.
> -Chris

Well, there isn't any SQL before calling Open, so the only answer I know is to
single step into the Open call.

--
Scott McPhillips [VC++ MVP]



Mon, 28 Jul 2003 09:47:37 GMT  
 Inspecting the SQL Statement BEFORE it executes on the Server
Switch on the tracing using the ODBC admin and
go thro' the log file. If you are using SQL 7.0
or higher, use Profiler.

George
http://gpoulose.home.att.net/


Quote:
> Hi,

> Background:
> -MFC
> -ODBC

> How can I see the SQL string that is being passed to the database server
> before it is executed on the server.

> For example

> CRecordSet::Open() executes some SQL "under the hood"... however, it
> constructs this according to the filter, the sort by, and if the class is
> using paramters.

> Can you tell me the line in the MFC source that holds the exact SQL
> statement that is used?

> Thanks
> -Chris



Sun, 03 Aug 2003 00:02:42 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Perform SQL statement in VC++ against MS SQL Server 7.0

2. Q:Use DISTINCT in SQL statement with OLE DB for SQL Server

3. execute sql statement with return value

4. execute sql statement with return value?

5. Newbie: Looking for Simplest Code to OpenConnection, OpenRecordset, Execute A SQL Statement Insert/Update

6. Executing SQL and LIKE Statement

7. SQLGetData Fails on Multiple Active Statement Handles with SQL Server 6.5

8. executing a ms sql server dts package

9. Executing stored procedure on sql server 2000 using c program

10. Executing program from SQL Server

11. SQL Syntax on SQL Server

12. SQL Server with CDatabase/CRecordset and server cursors

 

 
Powered by phpBB® Forum Software