Sunday, February 26, 2012

Getting identity value

I am using ADO to connect to SQL 2k db. We have converted it to merge
replication and now I am not getting identity field value after I use the
Update method. For example:
rsPayInfo.AddNew
rsPayInfo("CheckAmt") = 100.00
rsPayInfo.Update
lngCheckID = rsPayInfo("CheckID")
The variable lngCheckID is returning a zero, which is not the actual value
on the new table entry. What do I need to do to retrieve the new CheckID?
Thanks.
Davidcheck the update command - it should be UPDATE ...; SELECT ...
to select the updated values
same for INSERT
David wrote:
> I am using ADO to connect to SQL 2k db. We have converted it to merge
> replication and now I am not getting identity field value after I use the
> Update method. For example:
> rsPayInfo.AddNew
> rsPayInfo("CheckAmt") = 100.00
> rsPayInfo.Update
> lngCheckID = rsPayInfo("CheckID")
> The variable lngCheckID is returning a zero, which is not the actual value
> on the new table entry. What do I need to do to retrieve the new CheckID?
> Thanks.
> David
>
>

No comments:

Post a Comment