简体   繁体   English

DataTable问题列的ADO.Net DataType

[英]ADO.Net DataType of column of DataTable issue

My question is how to assign the DataType value for columns of special SQL Types like, uniqueidentifier/nvarchar/datetime/varbinary(max) -- I did not find a mapping between .NET data type and such 4 types of SQL column data type? 我的问题是如何为特殊SQL类型的列(如uniqueidentifier / nvarchar / datetime / varbinary(max))分配DataType值-我没有找到.NET数据类型与这4种类型的SQL列数据类型之间的映射?

Here is a sample, which shows we need to assign the DataType (this sample maps .NET type to SQL column data type) of each column of the DataTable. 这是一个示例,它表明我们需要为DataTable的每个列分配DataType(此示例将.NET类型映射为SQL列数据类型)。

http://msdn.microsoft.com/en-us/library/system.data.datatable.aspx http://msdn.microsoft.com/zh-CN/library/system.data.datatable.aspx

Assuming you are talking about the DataType property on the DataColumn class, this is how you would map the types: 假设您正在谈论DataColumn类的DataType属性,这就是您映射类型的方式:

  • uniqueidentifier - Guid uniqueidentifier-引导
  • nvarchar - String nvarchar-字符串
  • datetime - DateTime datetime-DateTime
  • varbinary(max) - byte[] varbinary(max)-字节[]

You can find the full list of mappings here: 您可以在此处找到映射的完整列表:

http://msdn.microsoft.com/en-us/library/ms131092.aspx http://msdn.microsoft.com/en-us/library/ms131092.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM