Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL AutoNumber - Identity

Status
Not open for further replies.

itflash

Programmer
Jul 18, 2001
535
GB
Hi all

I have a form based on a remote SQL Server View.

When I do a tableupdate on the save button, I require the new auto number from the key identity field. I cannot seem to get it. If I do a requery, the record pointer goes back to record number 1.

I have tried the @@Identity as below:

holder=SQLCONNECT("mydb", "sa", "a")
a=SQLEXEC(holder, "select @@identity", "newids")
WAIT WINDOW STR(a)
=SQLDISCONNECT(holder)
SELECT * from newids

But I keep getting .NULL.


Any ideas?
Thanks
ITFlash
 
your question puts me at a loss, what are you trying to do?

are you calling a strored procedure?

are you trying to get the next id of a new record added to the remote view? Attitude is Everything
 
...sorry....figured it out....


I was trying to find out the newly added AutoNumber ID in a SQL Server record from a remote view. I bound a grid to the remote view.

The way the @@identity works is that you have to use the same connection handle as the view you are working with. Therefore, if your remote view is in the dataenvironment, then you need to use the form connection.

Thanks
ITFlash

 
How did you determine the connection handle? I am inserting using a remote view and need to retrieve the last identity value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top