Tuesday, August 23, 2011

Bug in ADODB.Command Parameters

Great, I found a bug in Microsoft's ADODB.Command parameters object, and I was unable to find any information on it anywhere on the interweb. The error message is "Incorrect Syntax near the keyword 'default'". On the surface, this is the SQL parsing engine complaining about the SQL using the reserved keyword 'default'.

It gets interesting when the SQL statement doesn't have the word 'default' in it. So what is causing the error message? It's actually an issue with the ADODB.Parameter. when a new ADODB.Parameter is created, the default value for the parameter appears to be DEFAULT. On top of that, if the ADODB.Parameter value is set to an empty string (''), then the value is changed internally to DEFAULT. In either case, ADODB is replacing the parameter placeholder with DEFAULT in the SQL statement, which fails parsing on SQL Server.

That's a really stupid bug, as an empty string is data. I want to be able to pass an empty string sometimes, as a empty string is not null or a space. What the heck Microsoft?

2 comments:

  1. I have been looking for a embroidery machine. An really like what I see with this brother machine.
    I saw your great review. Brother should pay you to write a description for them. You have convienced me to purchase. Hope you get a cut. I design clothes for a friend Cathy. But I want to do more and I think this is just the thing I need. Thanks for your review
    Rick richosea@gmail.com

    ReplyDelete
  2. I know this is an old post but how did you fix this problem?

    ReplyDelete