Assuming you want to find all records where each word appears in at least one of the four columns, something like this should work:
sqlcmd = sqlcon.CreateCommand();
string[] words = textBox1.Text.Split(new[] { '+' }, StringSplitOptions.RemoveEmptyEntries);
StringBuilder query = new StringBuilder("SELECT * FROM T1 WHERE 1 = 1");
for (int index = 0; index < words.Length; index++)
{
string wordToFind = words[index];
string parameterName = "@word" + index;
sqlcmd.Parameters.AddWithValue(parameterName, "%" + wordToFind + "%");
query.AppendFormat(" AND (EnglishWord Like {0} OR EnglishDesc Like {0} OR ArabicWord Like {0} OR ArabicDesc Like {0})", parameterName);
}
sqlcmd.CommandText = query.ToString();
This will also fix the
SQL Injection[
^] vulnerability in your code.
If the user searches for
burden+proof, the resulting query will look something like this:
SELECT
*
FROM
T1
WHERE
1 = 1
And
(
EnglishWord Like @word0
Or
EnglishDesc Like @word0
Or
ArabicWord Like @word0
Or
ArabicDesc Like @word0
)
And
(
EnglishWord Like @word1
Or
EnglishDesc Like @word1
Or
ArabicWord Like @word1
Or
ArabicDesc Like @word1
)