Anybody got a C# function that maps the SQL datatype of a column to its CLR equivalent?

后端 未结 12 1712
逝去的感伤
逝去的感伤 2020-12-12 16:18

I\'m sitting down to write a massive switch() statement to turn SQL datatypes into CLR datatypes in order to generate classes from MSSQL stored procedures. I\'m using this c

12条回答
  •  鱼传尺愫
    2020-12-12 16:57

    You don't need a function.I think you may be looking for

    dt.Columns[i].DataType.UnderlyingSystemType
    

    dt - dataTable

    This will return the CLR type for corresponding column. Hope this helps and BTW this is my first answer on stack overflow

提交回复
热议问题