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

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

问题描述

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

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

推荐答案

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

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#数据表在位置0插入列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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