I want to convert a DataTable
with 10 rows or more into an Array like this:
SqlConfiguration clist2 = new SqlConfiguration();
clist2.QueryString = "SELECT caption_id,caption,description FROM sws_template_detail WHERE template_id = 1";
DataTable db = clist2.GetRecords;
ListItem datalist = new ListItem();
foreach(DataRow row in db.Rows)
{
datalist = new ListItem
{
id = row["caption_id"].ToString(),
title = row["caption"].ToString(),
description = row["description"].ToString()
};
}
var section = new Section
{
title = "Title",
items = new ListItem[]
{
datalist
}
};
But the resulting data is only 1 row, how can I solve it?