如何创建和检索自动编号字段 [英] How to create and retrieve an autonumber field

查看:65
本文介绍了如何创建和检索自动编号字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天第一次使用Access ODBC连接器连接到JET引擎并需要一些基础知识。

我甚至不确定Access(前端)专家是否精通SQL,但这里有:


在MySQL或SQLite3 DB上我会使用:

I just connected to the JET engine for the first time today using the Access ODBC connector and need some basics.
I''m not even sure that Access (front end) experts are versed in SQL, but here goes:

On a MySQL or SQLite3 DB I''d use:

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | 换行 | 行号

推荐答案

第一部分确定。使用自动编号主键创建表的语法如下:

OK for the first part. The syntax to create a table with an autonumber primary key is as follows:

展开 | 选择 | Wrap < span class =codeDivider> | 行号


供参考可能会发现这一点好一点。

http://支持.microsoft.com / ph / 2509


我们总是在这里提供帮助。


其中一件事你需要知道的是JET引擎会在存储记录时强加自己的排序顺序,这是检索最新记录的唯一方法记录是通过选择自动编号主键的MAX。

For reference purposes you might find this a little better.

http://support.microsoft.com/ph/2509

We''re always here to help though.

One of the things you need to know is the JET Engine will impose its own sort order on storing records so the only way to retrieve the latest record is by selecting the MAX of the autonumber primary key.

展开 | 选择 | Wrap | 行号



我甚至不确定Access(前端)专家是否精通SQL,但这里有:
I''m not even sure that Access (front end) experts are versed in SQL, but here goes:



我们必须一般为Access Query创建者是有限的。实际上,它用于create table的语法非常不同。类似......


SELECT Column1,Column2 INTO NewTable;


但是你可以看到这是非常有限的语法。 Jet引擎虽然支持SQL Create Table查询。它将其定义为数据定义查询。语法与您习惯的语法略有不同。

We have to be generally as the Access Query creator is limited. Actually the syntax it uses for create table is very different. Something like ...

SELECT Column1, Column2 INTO NewTable;

However as you can see this is very limiting syntax wise. The Jet engine will support a SQL Create Table query though. It defines it as a "Data Definition Query". The syntax will vary slightly from what you are used to though.


这篇关于如何创建和检索自动编号字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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