如何使用c#将数据从Array插入DataTable

时间:2016-12-08 23:57:00

标签: c# asp.net c#-3.0

我需要将数组插入数据表的特定列

例如

string[] arr1 = new String[] { "a", "b", "c" };

string[] arr2 = new String[] { "d", "e", "f" };

Datatable dt = new Datatable();

dt.columns.Add("Column1");

dt.columns.Add("Column2");

现在我想将' arr1插入column1'并且' arr2进入第2列'?

Column1     Column2
     a            d
     b            e
     c            f

请有人给我解决方案......

1 个答案:

答案 0 :(得分:1)

要将数据添加到DataTable中,您需要创建>>> from skimage import io >>> img = io.imread('my_image.tif') 并将行的列设置为等于该列的数据。

>>> import cv2
>>> img = cv2.imread('my_image.tif', -1)
>>> img[0:2, 0:2]
array([[  1.22543551e-41,   1.24953784e-41],
       [  1.24967797e-41,   1.32829081e-41]], dtype=float32)
>>> img.dtype = np.int32
>>> img[0:2, 0:2]
array([[8745, 8917],
       [8918, 9479]])