I wish to get the autoid from sqlsever when inserting a new record.
The vfp9 recordrefresh only seems to work if i in addition maintain my own
unique id and specify itin the keyfieldlist

Am i missing something?

thanks

Greg

Re: cursoradapter.recordrefresh by Thierry

Thierry
Tue Feb 15 04:24:48 CST 2005

KeyFieldList="id" && (this is the identity() column)
UpdatableFieldList="field1, field2, ..." && excude "id"
UpdateNameList="id table1.id, field1 table1.field1, field2 table1.field2" &&
put here "id"
...

Don't use RecordRefresh,
use a stored procedure to perform the insert command , or use the
AfterInsert Event like this:

PROCEDURE AfterInsert(cFldState, lForce, cInsertCmd, lResult)
IF lResult
LOCAL cAlias
calias = Alias()
SQLExec(this.DataSource,"SELECT @@IDENTITY id","table1_id")
replace (this.Alias+".id") with table1_id.id
SELECT (cAlias)
ENDIF
ENDPROC


--
Thierry


"Greg" <Greg@discussions.microsoft.com> a écrit dans le message de news:
3C9B0F1A-0E6D-40DF-A563-A7C7F6DED795@microsoft.com...
>I wish to get the autoid from sqlsever when inserting a new record.
> The vfp9 recordrefresh only seems to work if i in addition maintain my own
> unique id and specify itin the keyfieldlist
>
> Am i missing something?
>
> thanks
>
> Greg