Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Claushingebjerg 936 posts 2571 karma points
    Nov 23, 2010 @ 12:07
    Claushingebjerg
    0

    Error when using macro picker datatype

    I have set up a mocro picker dataype and allowed it to use a macro called "brands".

    The barnds macro contains to parameters, "imageID" (mediacurrent) and "link" (contentpicker)

    When saving a page after choosing the parameters i get the following error:

    Conversion failed when converting the nvarchar value '<?UMBRACO_MACRO  macroalias="Brands"  imageID="1076"  link="1064"  />' to data type int.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value '<?UMBRACO_MACRO  macroalias="Brands"  imageID="1076"  link="1064"  />' to data type int.

    Any ideas?

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Nov 23, 2010 @ 13:40
    Robert Foster
    0

    The error message is telling you that it can't store the macro string in the database datatype, which appears to be set as INT.  You need to change it to NVARCHAR if possible...

    If this doesn't answer your question, perhaps you could clarify - what do you mean by a Macro Picker Datatype?  Do you mean the Macro Container datatype?

  • Claushingebjerg 936 posts 2571 karma points
    Nov 23, 2010 @ 13:45
    Claushingebjerg
    0

    Im sorry. of course i mean the "macro container" datatype. Don't know where i got the "picker" from :)

    I've looked through both the datatype settings and the macro settings, and i cant find anything that can be set as "int" or "nvarchar"...

  • Claushingebjerg 936 posts 2571 karma points
    Nov 23, 2010 @ 13:46
    Claushingebjerg
    0

    are either "imageID" or "link" reserved by umbraco for something perhaps?!?! Could this it?

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Nov 23, 2010 @ 14:03
    Robert Foster
    1

    nope, it's nothing to do with that.

    About the only thing I can suggest to "reset" the database datatype is try the following.  It involved changing your datatype:

    1. Change the Render Control to "Textbox" from the drop down and press save.

    2. You should now be able to see a "Database datatype" field, and it's value is most likely currently set to "Int".  Change that back to "Nvarchar" and save it again.

    3. Now change the Render Control back to "Macro Container", press save and select the macro's you want to allow again.

    There is another way you could fix this, but it involves editing the database directly.  If you want to go down this route, let me know.

    Hope this helps,

  • Claushingebjerg 936 posts 2571 karma points
    Nov 23, 2010 @ 14:09
    Claushingebjerg
    0

    It worked, thanks

    It was actually set to date. isnt it a bit strange that a type that is NOT selected has influence on a type that IS selected?!?! is this a bug or a feature?

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Nov 23, 2010 @ 14:27
    Robert Foster
    0

    yeah, I've noticed that sometimes the database datatype isn't what you expect.  probably a bug in the Macro Container render control in that it doesn't set the datatype properly.

Please Sign in or register to post replies

Write your reply to:

Draft