|
 |
activex_data_objects thread: Copying ADO RecordSet Using Append() -->error 0x80040e21
Message #1 by jose.joye@a... on Tue, 29 May 2001 11:22:07
|
|
Hello,
I have an openned (disconnected) ADO RecordSet and I need to add an extra
field to it.
To do so, I have created a new disconnected Recordset and I trying to copy
the definition/data of the first Recordset and add the extra field. I'm
using the Append method.
My problem is the following:
I'm getting error 0x80040e21 [in Field20::PutValue method] when copying a
particular field data from source to destination.
By playing with the 4th param of Append() [adFldUnspecified,
spRsSrc->GetFields()->Item[x]->Attribute, ...], I managed to have the error
on differant fields.
Am I doing something wrong?
Jose
I'm using Windows2000 , VC++ 6 sp4 and MDAC 2.6
Here is an extract of my code:
==============================
_RecordsetPtr spRsDest;
spRsDest.CreateInstance(__uuidof(Recordset));
long nlimit = spRsSrc->GetFields()->Count;
// Copy struct of existing Rset
for (long x = 0; x<nlimit; x++)
spRsDest->Fields->Append (spRsSrc->GetFields()->Item[x]->Name,
spRsSrc->GetFields()->Item[x]->Type,
spRsSrc->GetFields()->Item[x]->DefinedSize,
adFldUpdatable,
vtMissing);
// Open our new Rset (in disconnected mode)
spRsDest->Open(vtMissing, vtMissing, adOpenDynamic, adLockBatchOptimistic,
adCmdText);
// Copy data content
while(spRsSrc->adoEOF == false)
{
spRsDest->AddNew();
for (long x = 0; x<nlimit; x++)
{
// Copy data
spRsDest->GetFields()->Item[x]->Value
spRsSrc->GetFields()->Item[x]->Value; // ERROR thrown here!!!!!!
// add value for my new field as needed...
}
spRsSrc->MoveNext();
}
Message #2 by Thomas Bellavia <TBellavia@V...> on Tue, 29 May 2001 17:05:43 -0400
|
|
If you write a field to the recordset, then do an update it will append the
table.
TCB
-----Original Message-----
From: jose.joye@a... [mailto:jose.joye@a...]
Sent: Tuesday, May 29, 2001 7:22 AM
To: ActiveX_Data_Objects
Subject: [activex_data_objects] Copying ADO RecordSet Using Append()
-->error 0x80040e21
Hello,
I have an openned (disconnected) ADO RecordSet and I need to add an extra
field to it.
To do so, I have created a new disconnected Recordset and I trying to copy
the definition/data of the first Recordset and add the extra field. I'm
using the Append method.
My problem is the following:
I'm getting error 0x80040e21 [in Field20::PutValue method] when copying a
particular field data from source to destination.
By playing with the 4th param of Append() [adFldUnspecified,
spRsSrc->GetFields()->Item[x]->Attribute, ...], I managed to have the error
on differant fields.
Am I doing something wrong?
Jose
I'm using Windows2000 , VC++ 6 sp4 and MDAC 2.6
Here is an extract of my code:
==============================
_RecordsetPtr spRsDest;
spRsDest.CreateInstance(__uuidof(Recordset));
long nlimit = spRsSrc->GetFields()->Count;
// Copy struct of existing Rset
for (long x = 0; x<nlimit; x++)
spRsDest->Fields->Append (spRsSrc->GetFields()->Item[x]->Name,
spRsSrc->GetFields()->Item[x]->Type,
spRsSrc->GetFields()->Item[x]->DefinedSize,
adFldUpdatable,
vtMissing);
// Open our new Rset (in disconnected mode)
spRsDest->Open(vtMissing, vtMissing, adOpenDynamic, adLockBatchOptimistic,
adCmdText);
// Copy data content
while(spRsSrc->adoEOF == false)
{
spRsDest->AddNew();
for (long x = 0; x<nlimit; x++)
{
// Copy data
spRsDest->GetFields()->Item[x]->Value
spRsSrc->GetFields()->Item[x]->Value; // ERROR thrown here!!!!!!
// add value for my new field as needed...
}
spRsSrc->MoveNext();
}
tbellavia@v...
$subst('Email.Unsub')
Message #3 by "Jose Joye" <Jose.Joye@a...> on Wed, 30 May 2001 13:55:09 +0200
|
|
I tried to call update() after each field I have updated. This make no
difference
Thanks,
Jose
Thomas Bellavia <TBellavia@V...> on 29.05.2001 23:05:43
Please respond to "ActiveX_Data_Objects"
<activex_data_objects@p...>
To: "ActiveX_Data_Objects" <activex_data_objects@p...>
cc:
Subject: [activex_data_objects] RE: Copying ADO RecordSet Using Append() -
->error 0x80040e21
If you write a field to the recordset, then do an update it will append the
table.
TCB
-----Original Message-----
From: jose.joye@a... [mailto:jose.joye@a...]
Sent: Tuesday, May 29, 2001 7:22 AM
To: ActiveX_Data_Objects
Subject: [activex_data_objects] Copying ADO RecordSet Using Append()
-->error 0x80040e21
Hello,
I have an openned (disconnected) ADO RecordSet and I need to add an extra
field to it.
To do so, I have created a new disconnected Recordset and I trying to copy
the definition/data of the first Recordset and add the extra field. I'm
using the Append method.
My problem is the following:
I'm getting error 0x80040e21 [in Field20::PutValue method] when copying a
particular field data from source to destination.
By playing with the 4th param of Append() [adFldUnspecified,
spRsSrc->GetFields()->Item[x]->Attribute, ...], I managed to have the error
on differant fields.
Am I doing something wrong?
Jose
I'm using Windows2000 , VC++ 6 sp4 and MDAC 2.6
Here is an extract of my code:
==============================
_RecordsetPtr spRsDest;
spRsDest.CreateInstance(__uuidof(Recordset));
long nlimit = spRsSrc->GetFields()->Count;
// Copy struct of existing Rset
for (long x = 0; x<nlimit; x++)
spRsDest->Fields->Append (spRsSrc->GetFields()->Item[x]->Name,
spRsSrc->GetFields()->Item[x]->Type,
spRsSrc->GetFields()->Item[x]->DefinedSize,
adFldUpdatable,
vtMissing);
// Open our new Rset (in disconnected mode)
spRsDest->Open(vtMissing, vtMissing, adOpenDynamic, adLockBatchOptimistic,
adCmdText);
// Copy data content
while(spRsSrc->adoEOF == false)
{
spRsDest->AddNew();
for (long x = 0; x<nlimit; x++)
{
// Copy data
spRsDest->GetFields()->Item[x]->Value
spRsSrc->GetFields()->Item[x]->Value; // ERROR thrown here!!!!!!
// add value for my new field as needed...
}
spRsSrc->MoveNext();
}
tbellavia@v...
$subst('Email.Unsub')
$subst('Email.Unsub')
Message #4 by jose.joye@a... on Wed, 30 May 2001 22:37:11
|
|
To get more info, I have place the following code after the error is
issued:
long abc = spRsDest->GetFields()->Item[x]->Status;
If I put as 4th param of Append(): "adFldUpdatable", the error is
adFieldDataOverflow
If I put as 4th param of Append():
"(FieldAttributeEnum)spRsDal->GetFields()->Item[x]->Attributes", the error
is adFieldDataOverflow
According to the documentation, this means:
adFieldDataOverflow Indicates that the data returned from the provider
overflowed the data type of the field
adFieldIntegrityViolation Indicates that the field cannot be modified
because it is a calculated or derived entity
This sound REALLY strange, I'm making a CCopy of the disconnect recordset
(including structure). Therefore, how could I get such an error?
> Hello,
>
> I have an openned (disconnected) ADO RecordSet and I need to add an extra
> field to it.
> To do so, I have created a new disconnected Recordset and I trying to
copy
> the definition/data of the first Recordset and add the extra field. I'm
> using the Append method.
> My problem is the following:
> I'm getting error 0x80040e21 [in Field20::PutValue method] when copying a
> particular field data from source to destination.
> By playing with the 4th param of Append() [adFldUnspecified,
> spRsSrc->GetFields()->Item[x]->Attribute, ...], I managed to have the
error
> on differant fields.
>
>
> Am I doing something wrong?
> Jose
>
> I'm using Windows2000 , VC++ 6 sp4 and MDAC 2.6
>
> Here is an extract of my code:
> ==============================
> _RecordsetPtr spRsDest;
> spRsDest.CreateInstance(__uuidof(Recordset));
> long nlimit = spRsSrc->GetFields()->Count;
>
> // Copy struct of existing Rset
> for (long x = 0; x<nlimit; x++)
> spRsDest->Fields->Append (spRsSrc->GetFields()->Item[x]->Name,
> spRsSrc->GetFields()->Item[x]->Type,
> spRsSrc->GetFields()->Item[x]->DefinedSize,
> adFldUpdatable,
> vtMissing);
>
> // Open our new Rset (in disconnected mode)
> spRsDest->Open(vtMissing, vtMissing, adOpenDynamic,
adLockBatchOptimistic,
> adCmdText);
>
> // Copy data content
> while(spRsSrc->adoEOF == false)
> {
> spRsDest->AddNew();
> for (long x = 0; x<nlimit; x++)
> {
> // Copy data
> spRsDest->GetFields()->Item[x]->Value
> spRsSrc->GetFields()->Item[x]->Value; // ERROR thrown here!!!!!!
> // add value for my new field as needed...
> }
> spRsSrc->MoveNext();
> }
>
>
>
>
>
>
>
Message #5 by "Wally Burfine" <oopconsultant@h...> on Thu, 31 May 2001 02:23:17 -0000
|
|
So what is the recordset you are opening? is it a stored procedure or view?
if so what is the underlying SQL that you are trying to open. The errors
sound like the dataset you are trying to open has some calculated fields or
something like that.
>From: jose.joye@a...
>Reply-To: "ActiveX_Data_Objects" <activex_data_objects@p...>
>To: "ActiveX_Data_Objects" <activex_data_objects@p...>
>Subject: [activex_data_objects] Re: Copying ADO RecordSet Using Append()
>-->error 0x80040e21
>Date: Wed, 30 May 2001 22:37:11
>
>To get more info, I have place the following code after the error is
>issued:
>
> long abc = spRsDest->GetFields()->Item[x]->Status;
>
>If I put as 4th param of Append(): "adFldUpdatable", the error is
>adFieldDataOverflow
>
>If I put as 4th param of Append():
>"(FieldAttributeEnum)spRsDal->GetFields()->Item[x]->Attributes", the error
>is adFieldDataOverflow
>
>According to the documentation, this means:
>adFieldDataOverflow Indicates that the data returned from the provider
>overflowed the data type of the field
>adFieldIntegrityViolation Indicates that the field cannot be modified
>because it is a calculated or derived entity
>
>This sound REALLY strange, I'm making a CCopy of the disconnect recordset
>(including structure). Therefore, how could I get such an error?
>
> > Hello,
> >
> > I have an openned (disconnected) ADO RecordSet and I need to add an
>extra
> > field to it.
> > To do so, I have created a new disconnected Recordset and I trying to
>copy
> > the definition/data of the first Recordset and add the extra field. I'm
> > using the Append method.
> > My problem is the following:
> > I'm getting error 0x80040e21 [in Field20::PutValue method] when copying
>a
> > particular field data from source to destination.
> > By playing with the 4th param of Append() [adFldUnspecified,
> > spRsSrc->GetFields()->Item[x]->Attribute, ...], I managed to have the
>error
> > on differant fields.
> >
> >
> > Am I doing something wrong?
> > Jose
> >
> > I'm using Windows2000 , VC++ 6 sp4 and MDAC 2.6
> >
> > Here is an extract of my code:
> > ==============================
> > _RecordsetPtr spRsDest;
> > spRsDest.CreateInstance(__uuidof(Recordset));
> > long nlimit = spRsSrc->GetFields()->Count;
> >
> > // Copy struct of existing Rset
> > for (long x = 0; x<nlimit; x++)
> > spRsDest->Fields->Append (spRsSrc->GetFields()->Item[x]->Name,
> > spRsSrc->GetFields()->Item[x]->Type,
> > spRsSrc->GetFields()->Item[x]->DefinedSize,
> > adFldUpdatable,
> > vtMissing);
> >
> > // Open our new Rset (in disconnected mode)
> > spRsDest->Open(vtMissing, vtMissing, adOpenDynamic,
>adLockBatchOptimistic,
> > adCmdText);
> >
> > // Copy data content
> > while(spRsSrc->adoEOF == false)
> > {
> > spRsDest->AddNew();
> > for (long x = 0; x<nlimit; x++)
> > {
> > // Copy data
> > spRsDest->GetFields()->Item[x]->Value
> > spRsSrc->GetFields()->Item[x]->Value; // ERROR thrown here!!!!!!
> > // add value for my new field as needed...
> > }
> > spRsSrc->MoveNext();
> > }
> >
> >
> >
Message #6 by "Jose Joye" <Jose.Joye@a...> on Thu, 31 May 2001 09:59:00 +0200
|
|
I agree with you, in the Select statement, I return for some fields
constant values. So the error may make sense if the 4th parameter is set to
"(FieldAttributeEnum)spRsDal->GetFields()->Item[x]->Attributes".
However, if this param is set to "adFldUpdatable", the returned error (
adFieldDataOverflow) is really strange.
Thank,
Jose
"Wally Burfine" <oopconsultant@h...> on 31.05.2001 04:23:17
Please respond to "ActiveX_Data_Objects"
<activex_data_objects@p...>
To: "ActiveX_Data_Objects" <activex_data_objects@p...>
cc:
Subject: [activex_data_objects] Re: Copying ADO RecordSet Using Append()
-->error 0x80040e21
So what is the recordset you are opening? is it a stored procedure or view?
if so what is the underlying SQL that you are trying to open. The errors
sound like the dataset you are trying to open has some calculated fields or
something like that.
>From: jose.joye@a...
>Reply-To: "ActiveX_Data_Objects" <activex_data_objects@p...>
>To: "ActiveX_Data_Objects" <activex_data_objects@p...>
>Subject: [activex_data_objects] Re: Copying ADO RecordSet Using Append()
>-->error 0x80040e21
>Date: Wed, 30 May 2001 22:37:11
>
>To get more info, I have place the following code after the error is
>issued:
>
> long abc = spRsDest->GetFields()->Item[x]->Status;
>
>If I put as 4th param of Append(): "adFldUpdatable", the error is
>adFieldDataOverflow
>
>If I put as 4th param of Append():
>"(FieldAttributeEnum)spRsDal->GetFields()->Item[x]->Attributes", the error
>is adFieldDataOverflow
>
>According to the documentation, this means:
>adFieldDataOverflow Indicates that the data returned from the provider
>overflowed the data type of the field
>adFieldIntegrityViolation Indicates that the field cannot be modified
>because it is a calculated or derived entity
>
>This sound REALLY strange, I'm making a CCopy of the disconnect recordset
>(including structure). Therefore, how could I get such an error?
>
> > Hello,
> >
> > I have an openned (disconnected) ADO RecordSet and I need to add an
>extra
> > field to it.
> > To do so, I have created a new disconnected Recordset and I trying to
>copy
> > the definition/data of the first Recordset and add the extra field. I'm
> > using the Append method.
> > My problem is the following:
> > I'm getting error 0x80040e21 [in Field20::PutValue method] when copying
>a
> > particular field data from source to destination.
> > By playing with the 4th param of Append() [adFldUnspecified,
> > spRsSrc->GetFields()->Item[x]->Attribute, ...], I managed to have the
>error
> > on differant fields.
> >
> >
> > Am I doing something wrong?
> > Jose
> >
> > I'm using Windows2000 , VC++ 6 sp4 and MDAC 2.6
> >
> > Here is an extract of my code:
> > ==============================
> > _RecordsetPtr spRsDest;
> > spRsDest.CreateInstance(__uuidof(Recordset));
> > long nlimit = spRsSrc->GetFields()->Count;
> >
> > // Copy struct of existing Rset
> > for (long x = 0; x<nlimit; x++)
> > spRsDest->Fields->Append (spRsSrc->GetFields()->Item[x]->Name,
> > spRsSrc->GetFields()->Item[x]->Type,
> > spRsSrc->GetFields()->Item[x]
->DefinedSize,
> > adFldUpdatable,
> > vtMissing);
> >
> > // Open our new Rset (in disconnected mode)
> > spRsDest->Open(vtMissing, vtMissing, adOpenDynamic,
>adLockBatchOptimistic,
> > adCmdText);
> >
> > // Copy data content
> > while(spRsSrc->adoEOF == false)
> > {
> > spRsDest->AddNew();
> > for (long x = 0; x<nlimit; x++)
> > {
> > // Copy data
> > spRsDest->GetFields()->Item[x]->Value
> > spRsSrc->GetFields()->Item[x]->Value; // ERROR thrown here!!!!!!
> > // add value for my new field as needed...
> > }
> > spRsSrc->MoveNext();
> > }
> >
> >
> >
$subst('Email.Unsub')
|
|
 |