通过ODBC访问Access mdb - 如何返回自动编号 [英] Accessing Access mdb via ODBC - how to return autonumber

查看:95
本文介绍了通过ODBC访问Access mdb - 如何返回自动编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望有人可以提供帮助。这是访问问题的一半。我正在使用的一半是Access Xp作为后端数据文件。我正在使用ODBC将

连接到数据文件。所有命令都是通过SQL类型语句(SELECT,

UPDATE& INSERT INTO)。 (我正在使用/试用Realbasic作为前端)。


使用INSERT INTO ....将记录(行)插入表格后

获取刚刚插入的

记录的计数器字段值的最简单方法是什么?


我考虑过SELECT Max(CounterField)FROM ....通过使用ODBC

这是我检索计数器字段值的唯一选择吗?


提前谢谢。


Steven Taylor

澳大利亚墨尔本。

Hope someone can help. This is half an Access question. The half I''m
using is Access Xp as a backend data file. I''m using ODBC to connect
to the data file. All commands are via SQL type statements (SELECT,
UPDATE & INSERT INTO). (I''m using/trialling Realbasic as a frontend).

After inserting a record (row) into a table using "INSERT INTO ...."
what is the easiest way to obtain the value of a counter field for the
record just inserted?

I have considered "SELECT Max(CounterField) FROM ....". By using ODBC
is this my only option in retrieving the counter field value?

Thanks in advance.

Steven Taylor
Melbourne, Australia.

推荐答案

Steven Taylor写道:
Steven Taylor wrote:
希望有人可以帮助。这是访问问题的一半。我正在使用的一半是Access Xp作为后端数据文件。我正在使用ODBC将
连接到数据文件。所有命令都是通过SQL类型语句(SELECT,
UPDATE& INSERT INTO)。 (我正在使用/试用Realbasic作为前端)。

使用INSERT INTO ....将记录(行)插入表格后,
是什么获取刚刚插入的
记录的计数器字段值的最简单方法是什么?

我考虑过SELECT Max(CounterField)FROM ....。通过使用ODBC
这是我检索计数器字段值的唯一选择吗?
Hope someone can help. This is half an Access question. The half I''m
using is Access Xp as a backend data file. I''m using ODBC to connect
to the data file. All commands are via SQL type statements (SELECT,
UPDATE & INSERT INTO). (I''m using/trialling Realbasic as a frontend).

After inserting a record (row) into a table using "INSERT INTO ...."
what is the easiest way to obtain the value of a counter field for the
record just inserted?

I have considered "SELECT Max(CounterField) FROM ....". By using ODBC
is this my only option in retrieving the counter field value?




您最好的选择是使用任何真实字段检索记录

使记录独一无二。这永远不应该是一个反击。



Your best option is to retrieve the record using whatever real fields
make the record unique. That should never be a counter.


Steven Taylor写道:
Steven Taylor wrote:
希望有人可以提供帮助。这是访问问题的一半。我正在使用的一半是Access Xp作为后端数据文件。我正在使用ODBC将
连接到数据文件。所有命令都是通过SQL类型语句(SELECT,
UPDATE& INSERT INTO)。 (我正在使用/试用Realbasic作为前端)。

使用INSERT INTO ....将记录(行)插入表格后,
是什么获取刚刚插入的
记录的计数器字段值的最简单方法是什么?

我考虑过SELECT Max(CounterField)FROM ....。通过使用ODBC
这是我检索计数器字段值的唯一选择吗?
Hope someone can help. This is half an Access question. The half I''m
using is Access Xp as a backend data file. I''m using ODBC to connect
to the data file. All commands are via SQL type statements (SELECT,
UPDATE & INSERT INTO). (I''m using/trialling Realbasic as a frontend).

After inserting a record (row) into a table using "INSERT INTO ...."
what is the easiest way to obtain the value of a counter field for the
record just inserted?

I have considered "SELECT Max(CounterField) FROM ....". By using ODBC
is this my only option in retrieving the counter field value?




您最好的选择是使用任何真实字段检索记录

使记录独一无二。这绝不应该是一个反击。



Your best option is to retrieve the record using whatever real fields
make the record unique. That should never be a counter.




为什么不呢?我使用插入nz()的dmax()函数


= nz(dmax(...))+ 1

And why not? I use the dmax() function inserted in nz()

=nz(dmax(...))+1
这是我检索计数器字段值的唯一选择吗?

提前致谢。

Steven Taylor
澳大利亚墨尔本。

I have considered "SELECT Max(CounterField) FROM ....". By using ODBC
is this my only option in retrieving the counter field value?

Thanks in advance.

Steven Taylor
Melbourne, Australia.



这篇关于通过ODBC访问Access mdb - 如何返回自动编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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