0
我在現有的Access 97' 創建表使用下面的命令數據庫:創建表數據庫 - 如何啓用Unicode壓縮
OleDbCommand cmd_createPlaylistNames2 = new OleDbCommand("CREATE TABLE PlaylistNames2 ([Anagnorisi] long, [PlaylistName] TEXT(50) WITH COMPRESSION, [PlaylistMaker] TEXT(50) WITH COMPRESSION," +
" [Duration] TEXT(50) WITH COMPRESSION, [Comments] TEXT(50), [FromAutomation] BIT, Primary Key (Anagnorisi))", con);
我然後填寫表格與數據數據集。當我用Office打開數據庫時,我設置爲WITH COMPRESSION的字段的Unicode壓縮屬性設置爲No. 任何想法爲什麼會發生這種情況?
編輯:
沒關係,我已經設置字段Unicode壓縮與DAO。
dao.DBEngine dbeng = new dao.DBEngine();
dao.Workspace wrkspc = dbeng.CreateWorkspace("", "admin", "", dao.WorkspaceTypeEnum.dbUseJet);
dao.Database db = wrkspc.OpenDatabase("C:\\Users\\user\\Desktop\\Merge2\\playlists.MDB", false, false, "");
dao.TableDef tabledef = db.TableDefs["PlaylistNames"];
dao.Field name = tabledef.Fields["PlaylistName"];
dao.Field maker = tabledef.Fields["PlaylistMaker"];
dao.Field duration = tabledef.Fields["Duration"];
dao.Field comments = tabledef.Fields["Comments"];
dao.Property propName = name.CreateProperty("UnicodeCompression", 1, -1, false);
name.Properties.Append(propName);
dao.Property propMaker = maker.CreateProperty("UnicodeCompression", 1, -1, false);
maker.Properties.Append(propMaker);
dao.Property propDuration = duration.CreateProperty("UnicodeCompression", 1, -1, false);
duration.Properties.Append(propDuration);
dao.Property propComments = comments.CreateProperty("UnicodeCompression", 1, -1, false);
comments.Properties.Append(propComments);
wrkspc.Close();
實際上我使用的是Jet 4.0。 – Pantelis 2011-12-21 07:48:25
@Pantelis但如果該文件是Access 97數據庫,則它是Jet 3.5格式。這是指定unicode壓縮是否相關的文件格式,因爲unicode壓縮控制字符存儲在文件中的方式。當然,您可以使用Jet 4.0來讀取Jet 3文件,但您會注意到,如果您更改計算機的代碼頁,文本數據似乎會發生變化,原因是Jet 3文件中的單字節字符與Jet 4庫中的雙字節字符。 – phoog 2011-12-23 00:28:04