Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ADO error code 800a0c93

81 views
Skip to first unread message

Michael Harvey

unread,
Aug 3, 2005, 11:14:20 PM8/3/05
to
What can be the cause of error 800a0c93 on :
TESTHR(picRs->AddNew(&rs)); ?

The provider is Microsoft.Jet.OLEDB.4.0.

The database is Access.

I have not given data for some of the fields in the record.


Frank Hickman [MVP]

unread,
Aug 4, 2005, 1:21:48 AM8/4/05
to
"Michael Harvey" <michaelhar...@sympatico.ca> wrote in message
news:%237SUcKK...@TK2MSFTNGP10.phx.gbl...

Probably your picRs recordset is not updateable. What type of cursor are
you using? How did you open the recordset?

--
============
Frank Hickman
Microsoft MVP
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


Michael Harvey

unread,
Aug 4, 2005, 9:04:17 AM8/4/05
to

"Frank Hickman [MVP]" <fhickman3_NOSP@M_noblesoft.com> wrote in message
news:uhuFTZLm...@TK2MSFTNGP15.phx.gbl...

> "Michael Harvey" <michaelhar...@sympatico.ca> wrote in message
> news:%237SUcKK...@TK2MSFTNGP10.phx.gbl...
>> What can be the cause of error 800a0c93 on :
>> TESTHR(picRs->AddNew(&rs)); ?
>>
>> The provider is Microsoft.Jet.OLEDB.4.0.
>>
>> The database is Access.
>>
>> I have not given data for some of the fields in the record.
>>
>>
>
> Probably your picRs recordset is not updateable. What type of cursor are
> you using? How did you open the recordset?
>
Here is the open statement, cursor type is adOpenForwardOnly:
pRs->Open("Data",
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\temp\\PAY5000.mdb;User ID=admin;Password=;" \
"jet oledb:system database='c:\\Documents and Settings\\Michael
Harvey\\Application Data\\Microsoft\\Access\\System1.mdw';" \
"jet oledb:database password='password';",
adOpenForwardOnly,adLockOptimistic,adCmdTable);


Daniel Crichton

unread,
Aug 4, 2005, 10:35:13 AM8/4/05
to

adOpenForwardOnly is a read only cursor. Try adOpenKeyset instead.

Dan


Michael Harvey

unread,
Aug 4, 2005, 10:52:58 AM8/4/05
to

"Daniel Crichton" <msn...@worldofspack.co.uk> wrote in message
news:ePj76GQm...@TK2MSFTNGP10.phx.gbl...
I got the same error using adOpenForwardOnly.


Michael Harvey

unread,
Aug 4, 2005, 11:06:49 AM8/4/05
to

"Daniel Crichton" <msn...@worldofspack.co.uk> wrote in message
news:ePj76GQm...@TK2MSFTNGP10.phx.gbl...
I got the same error using adOpenKeyset.


Stephen Howe

unread,
Aug 4, 2005, 11:37:43 AM8/4/05
to
> What can be the cause of error 800a0c93 on :
> TESTHR(picRs->AddNew(&rs)); ?

You have a table called "Data" right?
What are the field types (I am interested in knowing if they are anything
other than Text or Number fields)? IIRC for Access, I think Memo fields
require special handling.

SH


Daniel Crichton

unread,
Aug 4, 2005, 11:45:14 AM8/4/05
to

Do you have the value of adOpenKeyset set anywhere? I'm not familiar with
the syntax you're using (I'm a VB programmer), but if adOpenKeyset isn't
defined then the value will be treated as 0 if there's no declaration
checking in your compiler, and therefore will still be adOpenForwardOnly (as
the value of adOpenForwardOnly is 0).

Do you have a primary key on the Data table?

Dan


Michael Harvey

unread,
Aug 4, 2005, 12:02:50 PM8/4/05
to

"Daniel Crichton" <msn...@worldofspack.co.uk> wrote in message
news:eZG2CuQm...@TK2MSFTNGP14.phx.gbl...
The value of adOpenKeyset is 1. The table has no primary key. None of the
fields are indexed.


Michael Harvey

unread,
Aug 4, 2005, 12:04:40 PM8/4/05
to

"Stephen Howe" <stephenPOINThoweATtns-globalPOINTcom> wrote in message
news:OqVI2pQm...@TK2MSFTNGP12.phx.gbl...
The field types are text, number, date/time, currency.


Frank Hickman [MVP]

unread,
Aug 4, 2005, 7:49:12 PM8/4/05
to
<snip>

> The value of adOpenKeyset is 1. The table has no primary key. None of the
> fields are indexed.
>

This may be the problem, in some circumstances, the recordset is marked as
read only if there is no primary key or no fields to uniquely identify a
row. You may also want to try adOpenSnapshot unless you need to know if
someone else has changed/added data, this should not be a problem. You may
also need to use a client side cursor.

Stephen Howe

unread,
Aug 4, 2005, 9:57:06 PM8/4/05
to
> What can be the cause of error 800a0c93 on :
> TESTHR(picRs->AddNew(&rs)); ?
>
> The provider is Microsoft.Jet.OLEDB.4.0.
>
> The database is Access.

Pardon me, but if _really_ _really_ want help you _should_ provide the
fullest information possible, not just the odd line of code that you think
might be relevant and 1-line replies. Your job is to provide as much
information as possible in order to make it easier for others to figure out
what the problem is. Being taciturn does not help.
Absolutely _NOWHERE_ did you state that you are using ADO Record Binding.
Why the hell not? It is 100% relevant.
It has just dawned on me from the above statement that that is exactly what
you are doing.

I would also be interested to know in addition

1. If this table is empty when the code is run
2. If any of the fields can be NULL

Try not using ADO Record Binding.
So no class variable derived from IADORecordBinding.
No binding of it to the RecordSet.

I bet you will find that it works if you use the RecordSet direct.

So (assuming that you have the right #import statement in effect)

picRs->AddNew();
// I am not sure if this syntax is 100% right. At work tomorrow, I can
verify it.
// But the jist of it is correct.
picRs->Fields->Items[0L]->Value = FieldValue0;
picRs->Fields->Items[1L]->Value = FieldValue1;
picRs->Fields->Items[2L]->Value = FieldValue2;
:
// however many fields there are in your table, you can leave out those that
are "defaulted" in Access
:
picRs->Update();

Does it work now?

Stephen Howe


Michael Harvey

unread,
Aug 5, 2005, 1:06:34 PM8/5/05
to

"Stephen Howe" <sjhoweATdialDOTpipexDOTcom> wrote in message
news:eTiX$DWmFH...@TK2MSFTNGP14.phx.gbl...
Hi Stephen. Yes, it works now, without ADO Record Binding.

To answer your other questions, it is not an empty table, and all of the
fields can be NULL.

I am a newby to ADO, and I just jumped into Visual C++ Extensions for ADO
and hit this snag. I am wondering if ADO.NET and C# would make my life
easier, except this is not a web page application. It is to run on a local
area network only, probably for security reasons, at this time. I would
appreciate any design considerations. Furthermore, I am using VC6 which is
no longer supported. Should I consider using Visual Studio.NET? Should I
consider ASP.NET? I am reading around as much as I can to understand.


Michael Harvey

unread,
Aug 5, 2005, 1:08:24 PM8/5/05
to

"Frank Hickman [MVP]" <fhickman3_NOSP@M_noblesoft.com> wrote in message
news:%23ie7IEV...@TK2MSFTNGP10.phx.gbl...

> <snip>
>
>> The value of adOpenKeyset is 1. The table has no primary key. None of the
>> fields are indexed.
>>
>
> This may be the problem, in some circumstances, the recordset is marked as
> read only if there is no primary key or no fields to uniquely identify a
> row. You may also want to try adOpenSnapshot unless you need to know if
> someone else has changed/added data, this should not be a problem. You
> may also need to use a client side cursor.
>
Thanks Frank,

I made one of the fields keyed, --> same error.
I don't have adOpenSnapshot available in ADO. I can't find the term in
searching MSDN.
I tried client side cursor --> same error.

I was able to get this working by not using ADO Record Binding. See my other
post.

Stephen Howe

unread,
Aug 5, 2005, 3:43:52 PM8/5/05
to
> Hi Stephen. Yes, it works now, without ADO Record Binding.

Right. Well the problem is in your RecordBinding code.
RecordBinding is woefully underdocumented by Microsoft and there are some
hidden gotchas.

1. If a field can be NULL, you have to have Status variables and you have to
use the field definition macros that include a Status variable. So

ADO_FIXED_LENGTH_ENTRY
ADO_NUMERIC_ENTRY
ADO_VARIABLE_LENGTH_ENTRY
ADO_VARIABLE_LENGTH_ENTRY2

The reason being is that the Status variable, on inspection (on reading)
whether that field is NULL.
If the Status variable is not NULL, you just inspect the field variable, it
was real data !!!
On updating (AddNew or Update), you can set the Status variable to adFldNull
which tells ADO that this field is to be set to NULL otherwise adFldOk.
If the Status is adFldOk, then ADO will assume the field variable is to be
written back.

2. If a field cannot be NULL, you can use the field definition macros that
don't include a Status variable.
It is optional. I use these as most of the tables I deal with don't have
NULLs. So

ADO_FIXED_LENGTH_ENTRY2
ADO_NUMERIC_ENTRY2
ADO_VARIABLE_LENGTH_ENTRY3
ADO_VARIABLE_LENGTH_ENTRY4

3. The gotchas I know about are these:

(i) There is some funny interaction between empty tables and attempting to
populate a table using AddNew and RecordBinding.
It does not always work. I have had failure on the first AddNew'ed record. I
can't remember if I got your error message number.
I think it is a problem getting the tables metadata (field types, sizes
properties etc).
The essential thing is that the derived RecordBinding class variables are
all 0 to start with - so do this in the constructor.
This guarantees it does work.
E.g. - one of my classes:

class CEventCountBind : public CADORecordBinding
{
BEGIN_ADO_BINDING(CEventCountBind)
ADO_FIXED_LENGTH_ENTRY2(1, adSmallInt, m_isISTVPanelID, FALSE)
ADO_FIXED_LENGTH_ENTRY2(2, adSmallInt, m_isISTVChanID, FALSE)
ADO_FIXED_LENGTH_ENTRY2(3, adInteger, m_iCount, FALSE)
ADO_FIXED_LENGTH_ENTRY2(4, adInteger, m_iAICount, FALSE)
END_ADO_BINDING()

public:
short m_isISTVChanID;
short m_isISTVPanelID;
int m_iCount;
int m_iAICount;

public:
// Constructor
CEventCountBind() : m_isISTVChanID(), m_isISTVPanelID(), m_iCount(),
m_iAICount() { }

};

m_isISTVChanID etc, will all be 0 to start with.

(ii) If you do have Status variables, they do need to be set to adFldNull
(if updating or inserting) otherwise always adFldOk.
If you leave them as some random value, it is this that is causing your
AddNew() problems.
AddNew() is reading the values you set (even if non-intentionally) and
acting on them in some way.
It is because of this "nuisance value", I use the non-Status RecordBinding
macros
(and makes your class smaller as each field variable does not have an
associated field status variable)
I only ever use the Status RecordBinding macros if I have to (ie.field can
be NULL) and observe rules mentioned here religiously for getting results.
It is this that Microsoft has never adequately documented.
If you Google around the Microsoft news server, searching for messages by
Roy Fine on ADO, he mentions this.

> I am a newby to ADO, and I just jumped into Visual C++ Extensions for ADO
> and hit this snag. I am wondering if ADO.NET and C# would make my life

> easier,...

Well that is your choice.
You will find that C# and ADO.NET has it's own learning curve.
Question: Is that good or bad?
Answer: Neither. Just about all Microsoft technologies have a learning
curve. C++ is heavier than most.
My advice is to heavily read Microsoft online documentation, frequent
newsgroups with more experienced programmers and read their responses (in
C++ cases, USENET comp.lang.c++ and comp.lang.c++.moderated is worth
frequenting - understand mind you they do not answer Windows questions,
Visual C++ tool questions, hardware questions - only questions related to
ISO C++ . Questions specific to VC++ should be asked on the Microsoft news
server), read whitepapers, read what is considered "Best Practice" for that
technology (deviating from "Best Practice" will usually burn you).

> except this is not a web page application. It is to run on a local
> area network only, probably for security reasons, at this time. I would
> appreciate any design considerations. Furthermore, I am using VC6 which is
> no longer supported. Should I consider using Visual Studio.NET?

I am using VC.NET 2003 (so that is VC7.1).
VC7.1 is much much more closer to standard C++ (as defined by the ISO C++
standard in 1998).
I used to use VC6 and would not move back.
Most died-in-the-wool C++ programmers want a standard-compliant compiler and
libraries (no C++ programmer wants the compiler to produce unexpected
results) and Microsoft, at last, has understood this. I think VC8 will be
even closer to standard and as soon as it is considered okay, we will
upgrade.

We produce non-NET applications with VC7.1.
They are not web-based, they are apps used internal to my company to deliver
data to our clients. They work.
Consequently we don't see any point of converting to .NET with them, there
is nothing to gain.

> Should I consider ASP.NET? I am reading around as much as I can to
understand.

It is up to you. I think if you need to make use of some technology that
.NET makes it easy to use, and a non-.NET app would be harder, then may be
should climb aboard the .NET bandwagon. But if your requirements are
undemanding, then I would prefer to develop a non-.NET app (Win32), there
is less overhead.
The technology your company is involved in should choose your tools.

On C# :
I was at the UK ACCU conference in Oxford, April 2005. Stoustrup was there.
Microsoft was there as well.
I think the consensus was that 2 years ago, C# was quite hot and "Managed
C++" (for .NET apps) was clunky. And it was.
But the past 2 years Herb Sutter and team have put a very good design effort
in using C++ for .NET and it shows.
Microsoft, internally, take C++ very seriously and compard to 2 years ago, I
think C++ would be recommended over C# for .NET apps (with VC8 that is)
They have done a very good job. With VC8, I would choose C++ over C#.

Another factor is that C++ is universal. It applies to IBM Mainframes,
Mini's, PC's, Macintoshes as well as different OS's like Linux.
And there are different C++ compilers from different vendors.
"Standard C++" is also larger than Microsoft and not controlled by Microsoft
(which some programmers might find a comforting thought)
There are more books on C++, more articles and in the long term I think the
job prospects might hav ethe edge as well.
Really C++ gives a job for life.
C# does not give you all this.

The downside of C++ is that it is an incredibly complex language.
It is a very powerful tool and like all tools can bite you if you do not
know what you are doing.
You could spend 10 years using it and still discover corners of the langauge
you did not know.
I think it has got easier over time.
But it is not a language that is friendly to newbie programmers.
C# is easier than C++, still powerful, and newbie programmers might find it
easier.

Stephen Howe


KP2 KP2

unread,
Jul 15, 2023, 8:59:47 PM7/15/23
to
chit the ard
0 new messages