Microsoft KB Archive/115516

= You receive an "Unable to write to file buffer State:S1000" error message when you call the Open method for a CDatabase or CRecordset object in Visual C++ =

Article ID: 115516

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 1.5 Professional Edition

 Microsoft Visual C++ 1.51

 Microsoft Visual C++ 1.52 Professional Edition

 Microsoft Visual C++ 2.0 Professional Edition</li></ul>

 Microsoft Visual C++ 2.1</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul>

 Microsoft Visual C++ 4.1 Subscription</li></ul>

 Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

 Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

 Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 4.2 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 5.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2002 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2003 Standard Edition</li></ul> </li> <li>Microsoft Data Access Components 2.5</li></ul>

-

<div class="notice_section">

This article was previously published under Q115516

<div class="symptoms_section">

SYMPTOMS
When you call the Open method for a CDatabase or CRecordset object, you receive one of the following error messages

General error: Unable to create file buffer.

State:S1000,Native:0,Origin:[Microsoft][ODBC Cursor Library]

General error: Unable to write to file buffer

State:S1000, Native:0, Origin:[Microsoft][ODBC Cursor Library]

General error: Unable to close file buffer

State:S1000, Native:0, Origin:[Microsoft][ODBC Cursor Library]

<div class="cause_section">

CAUSE
By default, the MFC ODBC CDatabase class loads the ODBC cursor library (16 bit: ODBCCURS.DLL, 32 bit: ODBCCR32.dll). This allows an application to define snapshot recordsets (the default) and scroll backward as well as forward through the recordset. This cursor library caches the records of a snapshot. To perform the caching, the 16-bit cursor library creates a temporary file in the directory that is specified by the TEMP environment variable or, if the TEMP variable is not defined, in the current directory. The 32-bit cursor library creates a temporary file in the current directory. A temporary file is created for each CRecordset object created. If the temporary file cannot be created, the error shown above occurs. This error most likely occurs for one of the following reasons:
 * There are not enough file handles available for the application.
 * There is not enough hard disk space available to create the file.

<div class="resolution_section">

RESOLUTION
To avoid the error message, increase the number of available file handles for the application. This can be done by calling the Windows API function SetHandleCount. Also, increase the number specified by the "FILES=" line in the Config.sys file.

Note In Microsoft Windows NT, calling the SetHandleCount function has no effect and Windows NT ignores the Config.sys file. Windows NT limits file handles solely on the amount of available memory.

Make sure that there is plenty of disk space available in the directory that is specified by the TEMP environment variable or the current working directory.

Additional query words: MfcDatabase

Keywords: kbtshoot kbdatabase kbprb kbfileio KB115516

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.