Your source for ASP-related frequently asked questions and answers! : ASP FAQS : Databases, Errors

Question: I'm getting an error (80020009) when trying to work with a value from a Memo (or text or blob) column. For example, I get this error when I do: Response.Write objRS(MemoColumnName)

Answer: If you return a set of rows from a database table using either the SELECT * or SELECT col1, col2, ..., colN methods and you are retrieving a Memo field you may receive the following error when trying to work with the results of the Memo column:

Microsoft OLE DB Provider for ODBC Drivers error '80020009'

When retrieving a Memo (or blob or text in SQL Server) column from a database, you need to make sure that in the SELECT list the Memo column comes last. For example, asssume that we have a table in an Access database named Table1 that has three columns: Name (a Text(50)), Age (a Number), and Description (a Memo). We may get the 8002009 error In our ASP page if we attempt to retrieve information from the table with the following SQL statement:

strSQL = "SELECT Description, Name, Age FROM Table1"
strSQL = "SELECT * FROM Table1"

Instead, we must explicitly specify that the Memo field come at the end of the SELECT list, like so:

strSQL = "SELECT Name, Age, Description FROM Table1"

For more information on this error be sure to check out:
PRB: 80020009 Error When Retrieving Data from SQL

Happy Programming!

FAQ posted by Scott Mitchell at 3/2/2001 4:10:13 PM to the Databases, Errors category. This FAQ has been viewed 54,771 times.

Copyright 2019 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers