Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Posting back my workaround:</p> <pre><code> public static string ParseValue(SqlDbType psdtParameter, string pstrValue, string pstrDateFormat = null) { object objReturn = new object(); if (pstrValue != "") { switch (psdtParameter.ToString()) { case "BigInt": objReturn = TypeDescriptor.GetConverter(typeof(Int64)).ConvertFromString(pstrValue); break; case "Bit": objReturn = TypeDescriptor.GetConverter(typeof(Boolean)).ConvertFromString(pstrValue); break; case "NText": case "NVarChar": case "VarChar": case "NChar": case "Text": case "Char": objReturn = TypeDescriptor.GetConverter(typeof(String)).ConvertFromString(pstrValue); break; case "SmallDateTime": case "DateTime": objReturn = DateTime.ParseExact(pstrValue, pstrDateFormat, CultureInfo.InvariantCulture); //TypeDescriptor.GetConverter(typeof(DateTime)).ConvertFromString(pstrValue); break; case "Money": case "SmallMoney": case "Decimal": objReturn = TypeDescriptor.GetConverter(typeof(Decimal)).ConvertFromString(null, CultureInfo.InvariantCulture, pstrValue); break; case "Float": objReturn = TypeDescriptor.GetConverter(typeof(Double)).ConvertFromString(pstrValue); break; case "Binary": case "VarBinary": case "Timestamp": case "Image": objReturn = TypeDescriptor.GetConverter(typeof(Byte[])).ConvertFromString(pstrValue); break; case "Int": objReturn = TypeDescriptor.GetConverter(typeof(Int32)).ConvertFromString(pstrValue); break; case "Real": objReturn = TypeDescriptor.GetConverter(typeof(Single)).ConvertFromString(pstrValue); break; case "SmallInt": objReturn = TypeDescriptor.GetConverter(typeof(Int16)).ConvertFromString(pstrValue); break; case "TinyInt": objReturn = TypeDescriptor.GetConverter(typeof(Byte)).ConvertFromString(pstrValue); break; } return objReturn.ToString(); } else { return null; } } </code></pre> <p>Tks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload