0

我读取的文件的页面大小是 32768。当我将 JET_paramDatabasePageSize 设置为 32768 时,JetInit 返回 -1213。然后,我将 JET_paramRecovery 设置为“Off”,JetInit 成功。但是,当我使用 JetAttachDatabase 时,它​​返回 -550。

这是我的代码:

err=JetSetSystemParameter(&instance,sesid,JET_paramDatabasePageSize ,32768 ,NULL);  
err=JetCreateInstance(&instance,NULL);
err=JetSetSystemParameter(&instance,sesid,JET_paramRecovery,0,"Off");
err=JetInit(&instance);
err=JetBeginSession(instance,&sesid,NULL,NULL);
err=JetAttachDatabase(sesid,buffer, JET_bitDbReadOnly );
err=JetOpenDatabase  ( sesid, buffer, NULL, &dbid, JET_bitDbReadOnly );

它有什么问题?我运行的是 Windows 7 32bit。

4

1 回答 1

0

The page size is global to the process (NOT just the instance) and is persisted in the log files and the database, so changing the page size can be annoyingly tricky.

Is there information in the database that you're trying to access? Or did you just experience this during development?

If you saw this during development, then the easiest thing to do is to blow everything away (del .edb edb) [Assuming that you kept the prefix as "edb"].

Also, are you sure that the database is 32k pages? You can confirm with esentutl.exe -mh <database-name>.

It will be trickier to recover the data if you do care about, and you switched the page size. (I don't know off the top of my head, and I'd have to try a few things out...)

-martin

于 2013-07-15T07:19:16.057 回答