从追加查询中获取主键值 [英] Get primary key value from append query

查看:54
本文介绍了从追加查询中获取主键值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库通过ODBC驱动程序链接到SQL Server后端。我知道在使用recordset.addnew方法时,要获取刚刚输入的记录的自动编号主键值,您必须将书签设置为最后修改的记录,然后转到该记录并从主键字段获取值。由于必须加密几个字段,我必须使用Append查询来插入数据(查询将对其进行加密)。我是否仍然可以使用为最后修改的记录添加书签的方法来获取主键值?

My database is linked through an ODBC driver to a SQL Server backend. I know that when using the recordset.addnew method, to get the auto numbered primary key value for the record just entered you have to set the bookmark to the last modified record and then go to that record and get the value from the primary key field. Due to having to encrypt a few fields, I have to use an Append query to insert the data (the query will encrypt it). Can I still use the method of bookmarking the last modified record to get the primary key value?

推荐答案

既然它是SQL Server,您可以尝试通过使用此SQL查询:
Since it''s SQL Server, you can try a pass through query using this SQL:
展开 | 选择 | Wrap | 行号


确保它是通过查询你和其他人一样。
Make sure it''s a "pass thru" query as you''ve done with the others.


我很抱歉回来这么晚。我周末过世了。


明天我会试一试。听起来很有希望。
My apologies for getting back so late. I was gone over the weekend.

I will give that a try tomorrow. It does sound promising.


这篇关于从追加查询中获取主键值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆