all groups > visual studio .net debugging > september 2005 >
You're in the

visual studio .net debugging

group:

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 robdob2003 NO[at]SPAM yahoo.com
9/29/2005 12:15:32 PM
visual studio .net debugging:
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;


Re: CRecordset not writing record nor giving errors on some XP Build 5.1 SP2 robdob2003 NO[at]SPAM yahoo.com
9/29/2005 8:26:23 PM
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

[quoted text, click to view]

Re: CRecordset not writing record nor giving errors on some XP Build 5.1 SP2 Tim
9/30/2005 12:07:08 PM
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

[quoted text, click to view]
try

[quoted text, click to view]

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

[quoted text, click to view]

Re: CRecordset not writing record nor giving errors on some XP Build 5.1 SP2 Tim
10/3/2005 12:00:00 AM
Are you looking in the right / same database for the new records?
- Tim

[quoted text, click to view]

AddThis Social Bookmark Button