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” %>

16 thoughts on “mm:dataset not well formed errors”

  1. 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. 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. 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. 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. 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. you just made me a VERY happy man. HOURS and HOURS of frustration due to stupid little single quotes… who’da thunk? 😀

  7. Thanks a lot, this was driving me crazy (I actually had the problem in an image control setting the AlternateText property)

    I can’t believe this was the problem

  8. Worked for two hours on this issue until I found this page – wow, can’t believe it – thank you!

  9. Mega Thumbs up for this tip… I’ve been working in .NET for 10 years and this issue just comes up again and again…. Thanks!

Comments are closed.