 |
| How to obtain the number of rows affected by remote UPDATE, INSERT or DELETE statement |
User rating: 0/10 (0 votes) | |
|
|
 |
 |
| Before you begin: |
 |
If _TALLY works perfectly for SQL statements executed on local tables, it can not be applied for statements performed against remote data sources.
This code shows how to use SQLRowCount function, which is fully supported by Visual FoxPro ODBC Driver. |
 |
 |
| |
| |
Members area. Log in to view this example. |
|
| |
|
|
|
|
|
 |
User rating: 0/10 (0 votes) | |
| 1872 bytes Created: 2003-07-17 14:28:52 Modified: 2011-12-10 09:20:22 Visits in 7 days: 83 |
|
 |
 |
| Listed functions: |
 |
|
 |
 |
| My comment: |
 |
The SQLRowCount requires a connection handle as a parameter. Such handle can be obtained by calling FoxPro SQLGetProp() function like this:
hStmt = SQLGetProp(hConn, "ODBChstmt")
where hConn is a connection handle returned by SQLConnect() function.
I could not get a valid response from the SQLRowCount in combination with native SQLExec() function. All the way I got ODBC error SQLSTATE=S1010 (Function sequence error). I use VFP 6, so I may expect it works properly with a newer FoxPro version.
After switching to ODBC API function SQLExecDirect the SQLRowCount immediately started to work, returning number of affected records for my UPDATE statements.
|
 |
 |
| Word Index links for this example: |
 |
|
|
 |
 |
| Translate this page: |
 |
|