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

G

Guest

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;
 
T

Tim

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
CRecsetTemplates* pRST2 = new CRecsetTemplates( m_pdatabase );
try

pRST2->Open();

pRST2->AddNew();

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

pRST2->m_TemplateID = oTemplates.m_Page2.m_templateid;

pRST2->Update();

delete pRST2;

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

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top