判断某列是否存在:
t.Columns.Contains(“bbb”);
DataTable t = new DataTable();
DataColumn col = new DataColumn("aaa");
t.Columns.Add(col);
col = new DataColumn("bbb");
t.Columns.Add(col);
col = new DataColumn("c");
t.Columns.Add(col);
bool b = t.Columns.Contains("bbb");

本文介绍了一种使用 C# 在 DataTable 中判断指定列是否存在的方法。通过实例演示了如何创建 DataTable 并添加列,随后检查特定列是否存在。

927

被折叠的 条评论
为什么被折叠?



