c#datatable在位置0插入列 [英] c# datatable insert column at position 0

查看:37
本文介绍了c#datatable在位置0插入列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道在数据表的 0 位置插入一列的最佳方法吗?

does anyone know the best way to insert a column in a datatable at position 0?

推荐答案

您可以使用以下代码在位置 0 的 Datatable 中添加列:

You can use the following code to add column to Datatable at postion 0:

    DataColumn Col   = datatable.Columns.Add("Column Name", System.Type.GetType("System.Boolean"));
    Col.SetOrdinal(0);// to put the column in position 0;

这篇关于c#datatable在位置0插入列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆