I am working on pulling a pipe delimited column from SQL and separating the pipe delimited values (names) from that column and adding them to an array. I want to read these values to check checkboxes. Can I get some insight on how to do this?


 Connection conn = new Connection();
 conn.Open(connections.ackconn);
 Recordset rs1 = new Recordset();
 string Sql1 = "";
 Sql1 = $"SELECT Clients FROM users WHERE Email =@email";
 rs1.Open(Sql1, conn);
 var clientsParse = new DataTable("Clients");
 clientsParse.Columns.Add(new DataColumn("a", typeof(string)));

clientsParse.AsEnumerable()
.Select(row => row["Clients"].ToString().Split('|'))
.ToList()
.ForEach(array => clientsParse.Rows.Add(array));

Related posts

Recent Viewed