CRecordset not writing record nor giving errors on some XP Build 5.1 SP2

CRecordset not writing record nor giving errors on some XP Build 5.1 SP2

Post by robdob200 » Sat, 01 Oct 2005 01:15:32


Hi,

I have a VC7++ VS2003 program that uses CRecordSet to write one record to a
SQLAnywhere database via ODBC, a Code Sniplet is contained below, on most
machine running the same OS and Build it works flawlessly, however on this
one XP Build 5.1 SP@ machine it never ends up writing the record. Nor does
it give any errors. Can someone please help with letting me know how to
resolve this. Also I tried creating a program in c# using ODBCDataAdapter
and was able to write records to this database..

MY VC7 VS2003 code sniplet below is this:

CRecsetTemplates* pRST2 = new CRecsetTemplates( m_pdatabase );

pRST2->Open();

pRST2->AddNew();

pRST2->m_TemplateName = "TEST TEMPLATE!!!!";

pRST2->m_TemplateID = oTemplates.m_Page2.m_templateid;

pRST2->Update();

delete pRST2;
 
 
 

CRecordset not writing record nor giving errors on some XP Build 5.1 SP2

Post by Tim » Sat, 01 Oct 2005 09:07:08

To start off with, for every open you should have a close.
You do not need to use a pointer for the recordset - using a pointer only
complicates code and requires a delete.

CRecsetTemplates RST2
RST2.m_pDatabase = m_pDatabase;

RST2.Open();
...

Does your table have a primary key?

you should wrap all DBMS interactions with try / catch handlers IE

try


catch(CDBExcception* e)
{
e->ReportError();
e->Delete();
}

 
 
 

CRecordset not writing record nor giving errors on some XP Build 5.1 SP2

Post by robdob200 » Sat, 01 Oct 2005 09:26:23

Thank you for your input,

however, it does not throw an exception, so it never enters into the catch
block.. and this works on 99% of the other XP machines, any other
suggestions?

thanks
 
 
 

CRecordset not writing record nor giving errors on some XP Build 5.1 SP2

Post by Tim » Tue, 04 Oct 2005 06:56:36

Are you looking in the right / same database for the new records?
- Tim