BUG: Inserting a New Record With addImmediate May Fail (190591)
The information in this article applies to:
- Microsoft Visual InterDev 6.0
This article was previously published under Q190591 SYMPTOMS
If you bind a server-side Recordset DTC to a table or query that has an ID
(AutoNumber) field as part of the primary key, an attempt to insert a new
record with addImmediate() after round-tripping the page may fail. This
typically happens when inserting records with some type of Active Server
Pages (ASP) data form. Similarly, if you are using addRecord() and
updateRecord() to insert new records, you could run into this bug if you
call updateRecord() and then addRecord() on the same round-trip.
CAUSE
When you insert a new record into a table or query that has an ID
(AutoNumber) field as part of the primary key, the value of the primary key
for the new record is unknown at the time of insertion. Therefore, the
Recordset cannot be returned to the current record when you round-trip the
page, and the Recordset is flagged as "non-updateable" to safeguard against
modifying an unknown record. If you then try to update the recordset or add
a new record, the operation will fail.
RESOLUTION
One simple workaround for this problem is to call the requery() method of
the Recordset DTC after you insert a new record. This will ensure the
Recordset is updateable when you round-trip the page. In the case where you
are using addRecord() and updateRecord() to insert new records, you should
call the requery() method after calling updateRecord().
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. We are researching this bug and will post
new information here in the Microsoft Knowledge Base as it becomes
available.
Modification Type: | Minor | Last Reviewed: | 3/7/2005 |
---|
Keywords: | kbBug kbCtrl kbDatabase kbpending KB190591 |
---|
|