mm:dataset not well formed errors

if you are using dreamweaver mx to code asp.net applications you will probably be using a lot of mm:dataset tags. if you ever need to edit the commandtext attribute of the mm:dataset tag, you may well see the charming error message “The server tag is not well formed”.

one possible reason for this error is the presence of single quotes in your query. for example, the following code will not work:

CommandText=’<%# “SELECT substring(description, 0, CHARINDEX(’ ‘, description, 200)) as intro FROM products” %>’

luckily there is an easy way to get rid of this error. simply remove the outer single quotes surrounding the attribute:

CommandText=<%# “SELECT substring(description, 0, CHARINDEX(’ ‘, description, 200)) as intro FROM products” %>

12 Responses to “mm:dataset not well formed errors”

  1. Mornington Says:

    Wow! This tip is amazing. I was almost ready to abandon using the MM:DataSet altogether (and hand coding it). Whew! It was so hard to find info or documentation on how to alter their tags!

    (I guess Dreamweaver does this so that it will be harder for hackers to enter single quotes into querries because of injection attacks? Who knows…)

  2. Mornington Says:

    BTW, while posting here I got this error :)
    Use of uninitialized value in substitution (s///) at plugins/Blacklist/lib/Blacklist/App.pm line 44.

  3. janine Says:

    hi mornington,

    thanks for letting me know about this. your comment got through ok but was not instantly approved due to how old this post was. my anti-spam plugin clearly needs some tweaking to stop the pesky error messages though!

  4. Mornington Says:

    The post might be old, but who would have thought that almost a year later this tip would still be helping total strangers! Cool! ;)

  5. janine Says:

    ah, it’s not that deep an insight or anything but thanks for saying thanks :) it’s nice that almost a year later someone left a comment to say i helped a little :)

  6. Robin Sengupta Says:

    The solution helped me too - VisualStudio 2005 - Jan2006. Thanks

  7. philip Says:

    you just made me a VERY happy man. HOURS and HOURS of frustration due to stupid little single quotes… who’da thunk? :D

  8. Gary from Galway Says:

    I like it thanks

  9. Adam - London Says:

    Awesome…sorted me out a treat!

  10. JM Says:

    This same error will happen if you have runat=”server” inside a comment.

  11. CM Says:

    Thanks a lot JM……. Ur tip saved my soul…

  12. Flyte Says:

    This helped me as well .. VS 2008 - July 08!!

    :D

Leave a Reply