Here's my problem. I have a textBox in which can be realised research with keyword. I have a checklistbox with different topic (ADV, Logistic, Finance, Administration) to filter the sql queries. If I search for a key word and I checked "logistic" the return result will only be related to "Logistic". This works well, the problem is that, if I check 2 checkbox, "logistic" and"finance" for example I will only have result related to "logistic" but I would like to have the 2 results.. I made it worked like 20 minutes ago and suddenly doesn't work anymore I don't undersand why. Can anyone tell me what am I missing ?
Here's my code :
string word = tbSearch.Text;
string strSql = @"SELECT CAST(ID as VarChar(50)) ID, Aggregation, DateDerniereSolution, DateDescription, DerniereSolution, DescriptionDemande, FileDeTraitement, NomContact, Numero, SousRubrique, TitreDemande
FROM cfao_DigiHelp_index.DigiHelpData WHERE ( 1 = 1 )";
string selectedValue = "";
bool IsFirst = false;
strSql += @" AND (";
foreach (ListItem item in CheckboxID.Items)
{
if (item.Selected)
{
selectedValue += item.Value ;
if (IsFirst)
{
strSql += " OR ";
}
strSql += " SousRubrique Like '%" + selectedValue + "%' ";
IsFirst = true;
}
if (CheckboxID.SelectedIndex == -1)
{
Label2.Visible = true;
Label2.Text = "Veuillez cocher au moins une rubrique";
}
}
strSql += @" )";
doesn't work anymoreare you getting any error or not getting the expected output?