I have following items in my list and i want to sort this list in multiple sub lists for further process.
my list items are,
Table=Corporate_Name$$
Table=Customer_Name$$sanjay
Table=Cutomer_Name_For_Print_At_Bottom$$sanjay
Table1=Company_Name$$RWL Healthworld Limited
Table1=Bill_Status$$G
Table1=Home_Delievery$$N
Table2=User_Name$$Nazam
Table2=User_Name$$Nazam
Table2=User_Name$$Nazam
Table3=payment_value$$305.49
Table3=cash_amount_taken$$1000.00
Table3=cash_amount_returned$$694.51
Table3=TenderName$$Cash
Table3=TenderType$$1
I want to make sub lists like,
list 1 having items whose starts with Table,
list 2 having items whose starts with Table1,
list 3 having items whoes starts with Table2,
and so on; however the number of tables are
What I have tried:
Adding code
cmd = new MySqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_GetPosBillDetail_ForPrint";
cmd.Parameters.Add(new MySqlParameter("inParam", onestr));
cmd.Parameters.Add(new MySqlParameter("outParam", "@outParam"));
cmd.Parameters["@outParam"].Direction = ParameterDirection.Output;
cmd.Connection = con1;
table = new DataTable();
DataSet ds = new DataSet();
adapter = new MySqlDataAdapter(cmd);
adapter.Fill(ds);
List<string> dtcol = new List<string>();
for (int i = 0; i < ds.Tables.Count; i++)
{
foreach (DataColumn column in ds.Tables[i].Columns)
{
for (int m = 0; m < ds.Tables[i].Rows.Count; m++)
{
dtcol.Add(ds.Tables[i] + "$$" + column + "$$" + ds.Tables[i].Rows[m][column].ToString());
}
}
}
I have tried with writing switch case but not working properly.
switch (dtcol[n].Substring(0,5))
{
case "Table":
break;
case "Table1":
break;
case "Table2":
break;
but i dont know number of tables thats why this logic is not possible.