Access 中的 SQLite 链接 table 只有在插入新值后才会给出 #Deleted 值
SQLite linked table in Access gives #Deleted values only after inserting a new value
在 MS Access (Office 365) 中,我在 SQLite 3 数据库中使用 SQLite ODBC driver (0.9996) 到 link 到 table。
问题
当我打开 linked table 它可以显示其内容,但是在我向 table 插入一个新条目后它在每个字段中显示 #Deleted
的新条目。关闭并重新打开 table 将正确显示新条目。我怎样才能防止这种异常行为,以便在插入新条目后它们可以正常显示而无需关闭并重新打开 table?
重现步骤
在 example.sqlite
中创建以下 table。
create table example (
id integer primary key,
sample_type text
);
使用 SQLite ODBC 驱动程序创建 linked table 并尝试将值插入 "sample_type" 列。
更改 text
列的类型以使用 data type supported by ODBC,例如 varchar(255)
。例如,此模式不会产生 #Deleted
值:
create table example (
id integer primary key,
sample_type varchar(255)
);
这个问题的发生是因为 SQLite allows values with multiple different types to be inserted into the same column,而 MS Access 非常严格地预先知道将插入到列中的数据的确切类型。因此,ODBC 驱动程序必须确定列的类型。如果您的模式使用 ODBC 数据类型,这会很好地工作,但是如果您创建一个具有 non-specific 列类型的列,例如 text
,ODBC 驱动程序必须猜测该列应该是什么类型。似乎不正确的猜测可能导致 #Deleted
值。
在 MS Access (Office 365) 中,我在 SQLite 3 数据库中使用 SQLite ODBC driver (0.9996) 到 link 到 table。
问题
当我打开 linked table 它可以显示其内容,但是在我向 table 插入一个新条目后它在每个字段中显示 #Deleted
的新条目。关闭并重新打开 table 将正确显示新条目。我怎样才能防止这种异常行为,以便在插入新条目后它们可以正常显示而无需关闭并重新打开 table?
重现步骤
在 example.sqlite
中创建以下 table。
create table example (
id integer primary key,
sample_type text
);
使用 SQLite ODBC 驱动程序创建 linked table 并尝试将值插入 "sample_type" 列。
更改 text
列的类型以使用 data type supported by ODBC,例如 varchar(255)
。例如,此模式不会产生 #Deleted
值:
create table example (
id integer primary key,
sample_type varchar(255)
);
这个问题的发生是因为 SQLite allows values with multiple different types to be inserted into the same column,而 MS Access 非常严格地预先知道将插入到列中的数据的确切类型。因此,ODBC 驱动程序必须确定列的类型。如果您的模式使用 ODBC 数据类型,这会很好地工作,但是如果您创建一个具有 non-specific 列类型的列,例如 text
,ODBC 驱动程序必须猜测该列应该是什么类型。似乎不正确的猜测可能导致 #Deleted
值。