How to add comma separated string into datatable in c#?

后端 未结 4 1913
北荒
北荒 2020-12-21 13:14

Let\'s consider I have two comma separated strings as written below.

string name = \"A,B,C,D\";
string value = \"100,200,300,400\";

So I wa

4条回答
  •  自闭症患者
    2020-12-21 14:08

    split sourse strings and add to datatable

        DataTable table = new DataTable();
        table.Columns.Add("name", typeof(string));
        table.Columns.Add("value", typeof(string));
    
        table.Rows.Add("nameStr", "valueStr");
    

提交回复
热议问题