I have installed the software along with the MDAC redistributable
executable to install the various drivers needed. It works well on a
number or machines but on some client machines, it fails during a call
to the ADO AddNew() function with the IDispatch Error #3105 and a
HRESULT 0x80040e21. I have not been able to locate what this error
means. I have not identified anything wrong with the installation.
I am posting to this newsgroup because of an old post I saw with the
same problem :
Posted by Stephen Schwab Re: CRowset::Insert() fails with error #3105
Quote -
"
I've created a
class CdboPERSON : public CTable<CAccessor<CdboPERSONAccessor> >
with the ATL Wizard.
I do
dboPerson.Open() ;
and
dboPerson.Insert() ;
Insert returns with an error: "IDispatch error #3105".
What went wrong?
"
Stephen on a later post says it was a multi-step OLEDB error.
Could someone tell me what this means and how it might help solving my
problem?
Thanks in advance.
Sent via Deja.com http://www.deja.com/
Before you buy.
One of the major causes of this error is attempting to insert a record with
an identity field. It's the DB provider's responsibility, not yours, to
assign a value to this field. If you're using ATL, you must specifically
set things up, using DBSTATUS_S_IGNORE, so that when you attempt to insert a
record with an identity field, ATL won't attempt to write that field.
Otherwise, the DB provider will fail with the superbly verbose error
mentioned above.
I'm sure that there's a way to tell your recordset that your identity
field's status is DBSTATUS_S_IGNORE, since field status is part of OLE DB.
- Chris
I'm not using an Auto Number field but the table structure is like this
-
Element Table :
ElementName - Text
IpAddress - Text, Primary Key
CommunityString - Text
ElementType - Number
Location - Text
ModelNo - Text
Status - Number
The function I'm calling is in a dll and inserts a record in this table.
Sorry if the code is ADO but I guess since it only encapsulates OLEDB,
it should be easy to follow.
code:
//smart pointer to a recordset
_RecordsetPtr pRstElement;
try{
//create a recordset
pRstElement.CreateInstance(__uuidof(Recordset));
//open the cursor - sz_element_tab is "Element_Table"
pRstElement->Open(sz_element_tab ,_variant_t((IDispatch *)
g_pConnection, true),adOpenKeyset,adLockOptimistic,adCmdTable));
// Add a new record. This is where it fails (throws exception)
pRstElement->AddNew();
//set field values from structure passed to dll function
pRstElement->Fields->Item[sz_name]->Value = pElementInfo-
>szElementName;
pRstElement->Fields->Item[sz_ipaddr]->Value = pElementInfo->szIpAddress;
<snip>
.
.
// Update the recordset
pRstElement->Update();
//Close the recordset
pRstElement->Close();
}
catch((_com_error &e)
{
//display the error
CString errorString;
errorString.Format(IDS_ADO_ERRSTR, e.Error(),e.ErrorMessage
(),(LPCSTR) e.Source(), (LPCSTR) e.Description());
AfxMessageBox(errorString);
}
The error message displayed is -
Code = 80040e21
Message = IDispatch error#3105
Source = (null)
Description = (null)
Now, if the error was reported by the provider, the source string above
would display the name of the provider. Which is why I think this is
somewhere in ADO/OLE DB.
Strange thing is, this was and is working perfectly in many sites. Its
only this one site where the IPAddress field in the table was something
like 10.130.3.23 where it failed !! When they changed it to something
like 192.158.103.154, it worked. This is really weird cos its a text
field and I don't really care whats put in it.
From my previous post, I had mentioned a post with the same problem
where the poster said it was "a multi-step OLEDB error". Its not much
but this is the only clue I have.
Thanks.
Paul
In article <#aBGEtTq$GA.193@cppssbbsa04>,