Thursday, January 30, 2014

how to set multiple items are selected in ListBox?

List<string> Authors = new List<string>(new string[] { "Jk Rowling""Morris Mano" });
 
foreach (ListItem item in ListBox1.Items)
{
    if (Authors.Contains(item.Text))
        item.Selected = true;
}

Subquery returning csv written values in a Main Query Column

select 
    categorie, 
    stuff((select ', ' + id
           from table2 t2 where t1.categorie = t2.categorie
           for xml path('')),
          1,2,'') [IDs]
from table1 t1