Author: ClayShannon | Posted on: 10/10/2008 8:11:37 AM | Views : 403

I know that I can use SQL parameters like this:

SqlConnection con = new SqlConnection(
ConfigurationManager.ConnectionStrings[
  "ConnectionString"].ConnectionString);
SqlCommand command = con.CreateCommand();
command.CommandText = "DELETE FROM BEST_PREDICTORS WHERE PREDICTOR = @PREDICTOR";
command.Parameters.AddWithValue("@PREDICTOR", APredictor);
con.Open();
command.ExecuteNonQuery();
con.Close();

...but can I do something similar with an existing SqlDataSource control such as:

SqlDataSource_ThrowTheBumsOut.DeleteCommand = "DELETE FROM CONGRESS WHERE (HEART = @COLOR) AND (BRAIN = @STATE)";
SqlDataSource_ThrowTheBumsOut.DeleteCommand.Parameters.AddWithValue("@COLOR", BLACK);
SqlDataSource_ThrowTheBumsOut.DeleteCommand.Parameters.AddWithValue("@STATE", DEAD);

...or how do I use parameters in this scenario ...

Go to the complete details ...