Skip to content
Loading
  • Rajanikant Hawaldar
    +3
    1. private const string intDataType = "int"; // declare it as globally  
    2. if(dt.Value != intDataType  && dt.Value.ToLower().Substring(0, 4).Equals("date"))  
    +3
  • +2

    dt.Value returns a string so this wouldn't work

    if(!dt.Value is int && dt.Value.ToLower().Substring(0, 4).Equals("date"))

    Would this be good answer?

    if(dt.Value != "int" && dt.Value.ToLower().Substring(0, 4).Equals("date"))

    +2
  • Rajanikant Hawaldar
    +2
    dt.Value contains any of the data type names?
    +2
  • +2

    Hi 

    Rajanikant Hawaldar,

    Yes, dt.Value contains values like "varchar" & "datetime" & "int" (which causes the error) but if I use your code I get this error:

    operator '!' cannot be applied to operands of type 'string' 

    +2