我使用以下代码从基于 WBTRV32.dll 的 BTrieve 6.15 数据库文件中收集数据我总是在读取下一个数据线的位置返回错误代码 22 - 这是我的 BTrieve 文件没有固定列宽的问题吗?
// Open file
RecordBuffer dataBuffer = new RecordBuffer();
int bufferLength = System.Runtime.InteropServices.Marshal.SizeOf(dataBuffer);
short status = (short)BTRCALL(0, positionBlock, ref dataBuffer, ref bufferLength, fileNameArray, 0, 0);
if (status == 0) <== Here Status = 0
{
// Get first record
dataBuffer = new RecordBuffer();
status = (short)BTRCALL(12, positionBlock, ref dataBuffer, ref bufferLength, fileNameArray, 0, 0); //BGETFIRST
if (status == 0) <== Here Status = 0
{
...
}
// Get subsequent records
while (status == 0) // BReturnCodes.END_OF_FILE or an error will occur
{
dataBuffer = new RecordBuffer();
status = (short)BTRCALL(6, positionBlock, ref dataBuffer, ref bufferLength, fileNameArray, 0, 0); //BGETNEXT
if (status == 0) <=== Here Status = 22 data buffer length overrun
{
}
}
}