Issue inserting rows in database using wxDbTable

Amit amitgupta.it at gmail.com
Thu Mar 29 04:16:35 PDT 2007


Hello,

My aim is to insert a row in the table using wxDbTable class. (I am
using Oracle 9i)

For this I had created a sample table with a single column using the
following script

"CREATE TABLE TESTBLOB
(
  ID  FLOAT(126)
)"

After this I used the following code to insert a row in the above
table

wxDb* ptrDB = ptrCDatabase->GetDBInstance(); // this is a valid
instance (I have checked)
ULONG              LinesOfCode = 0;

wxDbTable BlobTable(ptrDB, wxT("TESTBLOB"), 1, (const wxString
&)wxEmptyString, !wxDB_QUERY_ONLY);
BlobTable.SetColDefs(0, wxT("ID"), DB_DATA_TYPE_INTEGER, &LinesOfCode,
SQL_C_ULONG, sizeof(LinesOfCode));

LinesOfCode = 10;
BlobTable.SetWhereClause(wxT(""));
int nCount = BlobTable.Count();  // this gives me a valid count if
there are values in the table

int nRetVal = BlobTable.Insert();
ptrDB->CommitTrans();

wxDbTable.Insert() function always returns ZERO in the above
scenario.
Please let me know if I am missing something

Thanks in advance

Regards
- Amit Gupta







More information about the wx-users mailing list