473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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;

Nov 17 '05 #1
3 1128
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();
}

<ro********@yahoo.com> wrote in message
news:Oa**************@TK2MSFTNGP10.phx.gbl... 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;

Nov 17 '05 #2
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

"Tim" <Tim@NoSpam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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();
}

<ro********@yahoo.com> wrote in message
news:Oa**************@TK2MSFTNGP10.phx.gbl...
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;


Nov 17 '05 #3
Tim
Are you looking in the right / same database for the new records?
- Tim

<ro********@yahoo.com> wrote in message
news:%2*****************@TK2MSFTNGP10.phx.gbl...
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

"Tim" <Tim@NoSpam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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();
}

<ro********@yahoo.com> wrote in message
news:Oa**************@TK2MSFTNGP10.phx.gbl...
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;



Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: GS | last post by:
Hi Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Desktop Engine on Windows NT 5.1 (Build 2600: Dodatek Service Pack. 1)...
20
by: MS | last post by:
Access 97 I want to requery the data being displayed on a form, then I want to return to the record I was in. Why doesn't this code work? Private Sub CmdRefsh_Click()
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
0
by: Senapathy | last post by:
Environment : WinXP SP2, .NET 2003 Std edition I posted a query to the group some days back asking about how to identify stack corruption / array bounds or buffer overruns using .NET compiler...
3
by: Rich Shepard | last post by:
I need to learn how to process a byte stream from a form reader where each pair of bytes has meaning according to lookup dictionaries, then use the values to build an array of rows inserted into a...
7
by: rfinch | last post by:
Very new to this but using the MS working with dynamics CRM 3.0 book to run web application to retrieve lead records from CRM 3.0. Have followed the book instructions on page 380-382. But am...
1
by: Mike C# | last post by:
Hi all, I'm writing a little app that uses ODBC to call a SQL 2K stored procedure several times in a loop, with a different parameter each time. The SP can return no results in some instances. ...
1
by: Bernard Elgar | last post by:
I have tried the following which errors out at rs.MoveLast. Can anyone help me? Please note I am not a programmer - but learning quickly :) Kind regards Bernard Access 2003 Code attached to a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.