
Getting the counter value after an addnew-SQL SERVER 2000/ADO
I am using SQL Server 2000 and am having problems with the code I have been
using forever with SQL 7 and now it is not working. Here is the deal...
I am doing an update on data that has just been inserted into the database.
In order to get the value of the ID I set the bookmark to the existing
bookmark and get the ID after that movement. No more. I get the following
error...
"Provider cannot determine the value. Possible reasons: The record was just
created, the default value for the field was not available, or the user has
not set a new value."
The following code was executed...
rsData.Open strSQL, DB_CONNECT, adOpenKeyset, adLockOptimistic
If mudtProps.m_isNew Then rsData.AddNew
'fill data fields
With rsData
.Fields("CC_DESC") = Trim$(mudtProps.m_desc) & sEmpty
.Update
If mudtProps.m_isNew Then
.Bookmark = .Bookmark
mudtProps.m_id = .Fields("CC_ID")
End If
.Close
End With
It is blowing up on the line that says .Bookmark = .Bookmark
Thanks for any answers to this problem or any suggestions to do it another
way.
Respectfully,
Bob Hansen