CFF KB - Carrz-Fox-Fire Promotions Knowledge Base
CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.Knowledge Base
- Breadrumbs:
Invalid attempt to call MetaData when reader is closed.
- Article ID:
7287 - Date Created
Sunday, May 25, 2025 - Last Updated
Sunday, May 25, 2025 - This Article Has been Viewed
0 times - Short Desc
When trying to use a closed recordset, this error will appear: "Invalid attempt to call MetaData when reader is closed." - Details
When closing a datareader or dataset, you cannot use the recordset unless you create a Global Variable to use instead. - Recreate Issue
Using the following code will reproduce the error.
If rs1.Read() Then
dim theRecord as Integer = rs1("AlbumArtistID")
End If
rs1.Close()
Then use this down the page.
getAlbumID.Parameters.Add(New SqlParameter("@ID", rs1("ID"))) - Resolve Issue
If you are going to close your Reader / Dataset and intend to make a call to the record, you will need to create a Global Variable.
Do the following.
Public Class GlobalVariables
Public Shared theRecord As Integer
End Class
If rs1.Read() Then
GlobalVariables.theRecord = rs1("AlbumArtistID")
End If
rs1.Close()






Share With Friends (Updated 6-8-2010)
Recent Articles
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24959
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21730
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19809
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 18295
- The backup set holds a backup of a database other than the existing 17094