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:
Microsoft OLE DB Provider for SQL Server (0x80040E21) Multiple-step OLE DB operation generated errors
- Article ID:
7295 - Date Created
Thursday, February 26, 2026 - Last Updated
Thursday, February 26, 2026 - This Article Has been Viewed
0 times - Short Desc
Using SQL Server Management Studio to generate scripts with comments cannot be transferred over into a single line of code. - Article Details
When creating your SQL Queries inside SQL Server Management Studio (SSMS) or other programs, you might add notes to yourself or to others explaining what a certain part does. These notes, called 'Comments', are surrounded by double dashes.
These comments are fine in a multi-line query, whether in SSMS or on your website.
However, they do not cross over on a single line of code. - Recreate Issue
The following example demonstrates code with notes (comments) in it.
UPDATE TableOne
SET Col3 = CASE
WHEN Col3 = 3 THEN 4
WHEN Col3 = 1 THEN 3
WHEN Col1 = ? THEN 1 -- Parameter 1: strCol1
ELSE Col3
END
WHERE Col2 = ? -- Parameter 2: strCol2
AND (Col3 IN (1, 3) OR Col1 = ?); -- Parameter 3: strCol1
The above works as expected in SSMS.
Taking the same code above and condensing it into a single line for your query will look like this.<%
sql.commandtext="UPDATE TableOne SET Col3 = CASE WHEN Col3 = 3 THEN 4 WHEN Col3 = 1 THEN 3 WHEN col1 = ? THEN 1 -- Parameter 1: strcol1 ELSE Col3 END WHERE col2 = ? -- Parameter 2: strcol2 AND (Col3 IN (1, 3) OR col1 = ?); -- Parameter 3: strcol1"
sql.Parameters.Append sql.CreateParameter("@col1", adVarChar, adParamInput, 25, getCol1)
sql.Parameters.Append sql.CreateParameter("@col2", adVarChar, adParamInput, 25, getCol2)
sql.Parameters.Append sql.CreateParameter("@col1", adVarChar, adParamInput, 25, getCol1)
%> - Resolve Issue
What is happening with the single-line code above is that the comments are still present. Everything after the comment is now void
To fix this issue, remove the comments from your code.<%
sql.commandtext="UUPDATE TableOne SET Col3 = CASE WHEN Col3 = 3 THEN 4 WHEN Col3 = 1 THEN 3 WHEN Col1 = ? THEN 1 ELSE Col3 END WHERE Col2 = ? AND (Col3 IN (1, 3) OR Col1 = ?)"
sql.Parameters.Append sql.CreateParameter("@col1", adVarChar, adParamInput, 25, getCol1)
sql.Parameters.Append sql.CreateParameter("@col2", adVarChar, adParamInput, 25, getCol2)
sql.Parameters.Append sql.CreateParameter("@col1", adVarChar, adParamInput, 25, getCol1)
%>
--------
Related Articles
Microsoft OLE DB Provider for SQL Server (0x80040E21) Multiple-step OLE DB operation generated error«

Share With Friends (Updated 6-8-2010)
Recent Articles
- Microsoft OLE DB Provider for SQL Server (0x80040E21) Multiple-step OLE DB operation generated errors 0
- Microsoft Store Crashed and cannot force it to shutdown in task manager 0
- The MERGE statement attempted to UPDATE or DELETE the same row more than once. 0
- BC30205: End of statement expected. 0
- The MERGE statement attempted to UPDATE or DELETE the same row more than once. 0
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