PRB: "Too Many Columns Defined in the Rowset" Error Message
ID: Q192141
|
The information in this article applies to:
-
ActiveX Data Objects (ADO), versions 1.5, 2.0, 2.1 SP2
-
Microsoft Visual Basic Professional and Enterprise Editions for Windows, versions 5.0, 6.0
SYMPTOMS
You get the following error when choosing a Recordset object:
Run-time error '-2147024882 (8007000e)'
Too many columns defined in the rowset.
CAUSE
The client-cursor engine supports a maximum of 255 fields.
RESOLUTION
If possible, use a server-side cursor, or select fewer fields.
STATUS
This behavior is by design. It is a design limitation of the client-cursor
engine.
MORE INFORMATION
When you choose a disconnected recordset or specify a CursorLocation of
adUseClient, ActiveX Data Objects (ADO) invokes the client cursor engine to
handle record caching and scrolling. The cursor engine has a maximum limit of 255 fields. If the recordset contains more than 255 fields, the error
listed in the SYMPTOMS section appears.
By specifying a server-side cursor, you will be able to return more fields,
if your provider supports it.
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this code "as is" without warranty of any kind, either express or implied, including but not limited to the implied
warranties of merchantability and/or fitness for a particular purpose.
Microsoft does not support modifications to this code.
The code listed in step four creates a dissociated recordset and saves the contents to disk.
Steps to Reproduce Behavior
- Create a new Standard EXE in Visual Basic. Form1 is created by default.
- Add a Reference for the Microsoft ActiveX Data Objects Library.
- Add a Command button named Command1 to the form.
- Add the following code to the form:
Option Explicit
Const MAX_FIELDS = 256
Private Sub Command1_Click()
Dim rs As ADODB.Recordset, I As Long
Set rs = New ADODB.Recordset
For I = 1 To MAX_FIELDS
rs.Fields.Append "Field" & I, adInteger
Next I
rs.Open "C:\Test.Rst"
rs.AddNew
For I = 0 To MAX_FIELDS - 1
rs(I) = I
Next I
rs.Update
rs.Save
rs.Close
Set rs = Nothing
End Sub
- Run the project and click the Command button. You will see the error listed in the SYMPTOMS section.
- Change the MAX_FIELDS constant to a smaller number (range 1-255) and re-run the project. You should not get an error.
© Microsoft Corporation 1998, All Rights Reserved.
Contributions by Malcom Stewart, Microsoft Corporation
REFERENCES
For more information about ActiveX Data Objects, please refer to your
Microsoft Visual Studio documentation.
Additional query words:
Keywords : kbADO kbADO210 kbDatabase kbVBp500 kbVBp600 kbGrpVBDB kbGrpMDAC kbDSupport kbMDAC210SP2
Version : WINDOWS:1.5,2.0,2.1 SP2,5.0,6.0
Platform : WINDOWS
Issue type : kbprb