summaryrefslogtreecommitdiff
path: root/src/examples/xb_ex_v4_upd_dbf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/xb_ex_v4_upd_dbf.cpp')
-rwxr-xr-xsrc/examples/xb_ex_v4_upd_dbf.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/examples/xb_ex_v4_upd_dbf.cpp b/src/examples/xb_ex_v4_upd_dbf.cpp
index 75d0641..d128eba 100755
--- a/src/examples/xb_ex_v4_upd_dbf.cpp
+++ b/src/examples/xb_ex_v4_upd_dbf.cpp
@@ -209,7 +209,7 @@ int main()
}
std::cout << "Switch value = [" << sFriend.Str() << "]" << std::endl;
- xbInt32 lZip;
+ xbInt32 lZip = 0;
if(( iRc = MyTable->GetLongField( "ZIPCODE", lZip )) < 0 ){
iErrorStop = 350;
throw iRc;
@@ -259,9 +259,15 @@ int main()
}
// example code to loop through the table
- for( xbUInt32 ul = 1; ul <= MyTable->GetRecordCount(); ul++ ){
+ xbUInt32 ulRecCnt;
+ if(( iRc = MyTable->GetRecordCnt( ulRecCnt )) != XB_NO_ERROR ){
+ iErrorStop = 430;
+ throw iRc;
+ }
+
+ for( xbUInt32 ul = 1; ul <= ulRecCnt; ul++ ){
if(( iRc = MyTable->GetRecord( ul )) != XB_NO_ERROR ){
- iErrorStop = 430;
+ iErrorStop = 440;
throw iRc;
}
// do something with the record here
@@ -271,9 +277,11 @@ int main()
/* Close database and associated indexes */
if(( iRc = MyTable->Close()) != XB_NO_ERROR ){
- iErrorStop = 440;
+ iErrorStop = 450;
throw iRc;
}
+ delete MyTable;
+
}
catch( xbInt16 iRc ){