I have dictionary (key, value) need to convert that into datatable in way that all keys are datatable coulmns and all respective values are in row. For eg Dic = (id,1) (Name,abc)(age,25)…
Datadable should be
Id,name,age
1,abc,25
I have dictionary (key, value) need to convert that into datatable in way that all keys are datatable coulmns and all respective values are in row. For eg Dic = (id,1) (Name,abc)(age,25)…
Datadable should be
Id,name,age
1,abc,25
Hi @Tate_S
Please follow the steps
Create a datatable variable dt and initialize New Datatable()
Create a string variable str
DictionaryName.Keys.ToArray
and change the type argument to Stringcurrentitem
type can be string for allstr = If(IsNothing(str),dictionaryname(currentitem).ToString,str + "," + dictionaryname(currentitem).ToString)
str.Split({","},StringSPlitOptions.None).ToArray()
cheers
Assign Activity:
Left Side: dtData | DataType: DataTable
Right side: Newtonsoft.Json.Linq.JArray.FromObject({yourDictVar}).ToObject(Of DataTable)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.