Problem:
Ajax suggest-search on [n] ingredients in recipes. That is: match recipes against multiple ingredients.
For instance:
You could at least parametrize the where clausule to avoid SQL injection, something alike:
using System.Data;
using System.Data.SqlClient;
using System.Text;
class Foo
{
public static void Main ()
{
string[] parameters = {"salt", "water", "flower"};
SqlConnection connection = new SqlConnection ();
SqlCommand command = connection.CreateCommand ();
StringBuilder where = new StringBuilder ();
for (int i = 0; i < parametes.Length; i++)
{
if (i != 0)
where.Append (",");
where.AppendFormat ("@Param{0}", i);
command.Parameters.Add (new SqlParameter ("Param" + i, parameters [i]));
}
}
}