简体   繁体   English

ms访问链接表缺少主键

[英]ms access linked table missing primary key

I'm not very familiar with MS Access, but a user would like us to create a link to a SQL Server database for him to connect to via MS Access for reporting needs. 我对MS Access不太熟悉,但是用户希望我们创建到SQL Server数据库的链接,以便他可以通过MS Access连接到报表需求。 I tried on my machine, using MS Access 2013, to connect to the database. 我尝试使用MS Access 2013在计算机上连接数据库。 I tried both options i'm provided with when connecting to an external datasource (ODBC Database). 连接到外部数据源(ODBC数据库)时,我尝试了提供的两个选项。 Import the source data as well as link the data source via a linked table. 导入源数据以及通过链接表链接数据源。

Both options import the table I want, via a Readonly account our DBA setup, but when I look at the table I noticed that the Primary Key (column name = Id) is missing when viewing in MS Access. 这两个选项都通过DBA设置的只读帐户导入我想要的表,但是当我查看该表时,我注意到在MS Access中查看时缺少主键(列名= ID)。 Also a bit field we have, which is populated in the SQL Server DB with 0 or 1, in MS Access has rows with -1 instead. 我们还有一个位字段,该字段在SQL Server DB中用0或1填充,MS Access中的行则用-1代替。

I tried to connect to the database using Sql Server Management Studio, using the Read only account and i'm able to see the primary key as well as the bit field fine. 我尝试使用Sql Server Management Studio,只读帐户连接到数据库,并且能够看到主键以及位字段。

Any ideas what I might be doing wrong, to be able to see the Primary Key and the bit field properly in MS Access. 任何想法我可能做错了,以便能够在MS Access中正确看到“主键”和“位”字段。

The second question you asked about why TRUE is represented as -1 has been asked before. 您之前问过的第二个问题,为什么将TRUE表示为-1。 It's the same convention as used in BASIC. 这与BASIC中使用的约定相同。 TRUE is equal to NOT FALSE. TRUE等于NOT FALSE。 If FALSE is represented with a zero in 16 bits, and if NOT is the bitwise complement, then TRUE is represented by 16 bits set to one. 如果FALSE用16位中的零表示,如果NOT是按位补码,则TRUE由设置为1的16位表示。

16 bits set to one, in twos complement notation, is equal to minus one. 以二进制补码表示的设置为1的16位等于负1。

What is the datatype of the ID column if it is an Int (Integer) then it should work fine but if not it may be incompatible with Microsoft Access. 如果ID列是Int(Integer),则该ID列的数据类型是什么,那么它应该可以正常工作,但如果不兼容,则可能与Microsoft Access不兼容。

The bit column can be set to use a Check Box if you go into the table design Select field and click Lookup Tab in the bottom pane. 如果您进入表设计的“选择”字段并单击底部窗格中的“查找”选项卡,则可以将位列设置为使用复选框。 This setting will not persist if you relink the table however. 但是,如果您重新链接表,此设置将不会保留。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM