See KB Article
HOWTO: Retrieving Calculated Fields from SQL Server 7.0
ID: Q219029
Here is a part copied from this article:
...
In Microsoft ActiveX Data Objects (ADO) the code would be as follows:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString =
"Provider=SQLOLEDB;Server=rrbman;Database=testdb;uid=sa;pwd=;"
cn.Open
rs.ActiveConnection = cn
rs.Properties("Server Data On Insert").Value = True
rs.Open "SELECT * FROM x", , adOpenKeyset, adLockOptimistic
rs.AddNew
rs.Fields(1) = "Test"
rs.Update
Debug.Print rs.Fields(0)
rs.Close
cn.Close
The table x is defined as;
create table x
(
f1 integer identity primary key,
f2 varchar(20)
)
Quote:> hello,
> i need to make available the current value of an identity file when i
> insert a new record.
> it works fine with the autonumber field in access but it doesnt with
> sqlserver7
> this is an example
> dim newIdentity as Long
> rs.addnew
> rs!nombre= "Byron"
> rs.update
> newIdentity = rs!nombre