c# long类型转化datatable
时间: 2023-10-28 19:54:28 浏览: 233
在C#中,将long类型转换为DataTable可以使用以下方法:
1. 创建一个DataTable对象,并添加相应的列:
```csharp
DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(long));
```
2. 将long类型的值添加到DataTable中的行:
```csharp
long value = 1234567890;
DataRow row = dt.NewRow();
row\["ID"\] = value;
dt.Rows.Add(row);
```
通过以上步骤,你可以将long类型的值转换为DataTable。
#### 引用[.reference_title]
- *1* *3* [C#利用反射将Datatable转化为指定实体类List<T>](https://blog.csdn.net/xuchen_wang/article/details/90605590)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [c#编码技巧(十):DataTable使用Linq、DataTable、List互相转化,创建DataTable、DataTable创建列、...](https://blog.csdn.net/u011340439/article/details/120527640)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文