Beispiel #1
0
        private void ReadValue(CremaDataRow dataRow, DataColumn dataColumn, string textValue)
        {
            var dataType = dataColumn.DataType;
            var value    = textValue as object;

            try
            {
                value = CremaXmlConvert.ToValue(textValue, dataType);
                dataRow.SetField(dataColumn.ColumnName, value);
            }
            catch (Exception e)
            {
                dataRow.SetField(dataColumn.ColumnName, textValue);
                dataRow.SetColumnError(dataColumn.ColumnName, e.Message);
            }
        }
Beispiel #2
0
        private void ReadValue(CremaDataRow dataRow, CremaDataColumn dataColumn, string textValue)
        {
            var dataType = dataColumn.DataType;
            var value    = textValue as object;

            try
            {
                value = CremaXmlConvert.ToValue(textValue, dataType);
                if (dataColumn.CremaType != null)
                {
                    if (long.TryParse(textValue, out long v) == true)
                    {
                        value = dataColumn.CremaType.ConvertToString(v);
                    }
                }
                dataRow.SetField(dataColumn, value);
            }
            catch (Exception e)
            {
                dataRow.SetField(dataColumn, textValue);
                dataRow.SetColumnError(dataColumn, e.Message);
            }
        }