x First time here? Check out the FAQ
  • Avatar824posts1944karma

    Custom DataType Question

    Lee started this topic More than a year ago , this topic was edited at: Friday, December 11, 2009 9:15 PM

    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?


  • Replies

  • Avatar760posts853karma
    Comment with ID: 21202
    Jesper Ordrup posted this reply More than a year ago

    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

     


  • Avatar455posts557karma
    Comment with ID: 21211
    skiltz posted this reply More than a year ago

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


Please login or Sign up To post replies