Issue inserting rows in database using wxDbTable

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


On Mar 29, 4:16 pm, "Amit" <amitgupta... at gmail.com> wrote:
> 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

Sorry for trouble, the problem is resolved

Thanks







More information about the wx-users mailing list