Copied to clipboard

Flag this post as spam?

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


  • Lee 1123 posts 3059 karma points
    Dec 11, 2009 @ 15:48
    Lee
    0

    Custom DataType Question

    Hey all - Decided to have a go a creating a DataType, and I'm using Tim's great post as an example

    http://www.nibble.be/?p=50

    One question I have is when saving DataType settings, in the example Tim saves to the DB like so with one setting

    SqlHelper.ExecuteNonQuery("insert into cmsDataTypePreValues (datatypenodeid,[value],sortorder,alias) values (@dtdefid,@value,0,'')", 
                        SqlHelper.CreateParameter("@dtdefid", _datatype.DataTypeDefinitionId), SqlHelper.CreateParameter("@value", data));

    But I want to have three settings on my DataType?  

    Looking at this example I'm thinking I would need to concat my three settings with a delimiter and save - Then split the string and sort the values out when I do my select statement?

    Is this the right way to do it? Or am I missing the point completely?

  • Jesper Ordrup 1000 posts 1478 karma points MVP
    Dec 11, 2009 @ 16:54
    Jesper Ordrup
    0

    Hi Lee,

    I found a snippet where I saved multiple settings:


    commandParameters = new SqlParameter[] { new SqlParameter("@value", this._parameter1.Text), new SqlParameter("@alias", "parameter1"), new SqlParameter("@dtdefid", this._datatype.DataTypeDefinitionId) };
    SqlHelper.ExecuteNonQuery(GlobalSettings.DbDSN, CommandType.Text, "insert into cmsDataTypePrevalues (datatypenodeid,[value],sortorder,alias) values (@dtdefid,@value,2,@alias)", commandParameters);
    commandParameters = new SqlParameter[] { new SqlParameter("@value", this._parameter2.Text), new SqlParameter("@alias", "parameter2"), new SqlParameter("@dtdefid", this._datatype.DataTypeDefinitionId) };
    SqlHelper.ExecuteNonQuery(GlobalSettings.DbDSN, CommandType.Text, "insert into cmsDataTypePrevalues (datatypenodeid,[value],sortorder,alias) values (@dtdefid,@value,2,@alias)", commandParameters);

     

    Hope this helps

    /Jesper

     

  • skiltz 501 posts 701 karma points
    Dec 11, 2009 @ 21:15
    skiltz
    0

    Store the vlaues as xml?? Thats what I've done in my custom datatypes,

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies