// Open the table for access
table->Open();
-// Set the WHERE clause to limit the result set to only
-// return all rows that have a value of 'GEORGE' in the
-// FIRST_NAME column of the table.
+// Set the WHERE clause to limit the result set to return
+// all rows that have a value of 'GEORGE' in the FIRST_NAME
+// column of the table.
table->SetWhereClause("FIRST_NAME = 'GEORGE'");
// Result set will be sorted in ascending alphabetical
wxMessageBox(msg, "Data", wxOK | wxICON_INFORMATION, NULL);
}
+
+//
+// Select the row which has FIRST_NAME of 'GEORGE' and LAST_NAME
+// of 'TASKER', then delete the retrieved row
+//
+table->SetWhereClause("FIRST_NAME = 'GEORGE' and "LAST_NAME = 'TASKER'");
+if (table->Query())
+{
+ table->Delete();
+
+ // Must commit the deletion
+ table->GetDb()->CommitTrans();
+}
+
+
+//
+// Insert a new row into the table
+//
+wxStrcpy(FirstName, "JULIAN");
+wxStrcpy(LastName, "SMART");
+table->Insert();
+
+// Must commit the insert
+table->GetDb()->CommitTrans();
+
+
// If the wxDbTable instance was successfully created
-// then delete it as I am done with it now.
+// then delete it as we are done with it now.
if (table)
{
- delete table;
- table = NULL;
+ wxDelete(table);
}
// If we have a valid wxDb instance, then free the connection
// Release the environment handle that was created
// for use with the ODBC datasource connections
-delete DbConnectInf;
+wxDelete(DbConnectInf);
\end{verbatim}