Q:

Inserting Data According To Dropdownlist Criteria

I got  2 datetimepicker, 1 dropdownlist, 1 gridview, 4 textboxes and 1 button in my asp.net project.
I choose the dates from datetimepicker and i choose the employee name from dropdownlist.
After i get the gridview according to that criterias. After that, i want to enter values in to the textboxes and i want to insert that values into the database with my button1_click event. Or if i can do that on source side.
How can i do that ? Please help.
Here is .cs codes ;
SqlConnection conn;
        SqlCommand cmd = new SqlCommand();
        string strSQL = "Insert INTO penalties(DAY,P1,P2,OVER) Values (@DAY,@P1,@P2,@OVER)";
        string bag_str = WebConfigurationManager.ConnectionStrings["asgdb01ConnectionString"].ConnectionString;
        conn = new SqlConnection(bag_str);
        conn.Open();
        cmd.Connection = conn;
        cmd.CommandText = strSQL;
        cmd.Parameters.Add(new SqlParameter("@DAY", TextBox3.Text));
        cmd.Parameters.Add(new SqlParameter("@P1", TextBox4.Text));
        cmd.Parameters.Add(new SqlParameter("@P2", TextBox5.Text));
        cmd.Parameters.Add(new SqlParameter("@OVER", TextBox6.Text));

        int i = cmd.ExecuteNonQuery();
        conn.Close();
        if (i > 0)
            Response.Write("Data Inserted");
        else
            Response.Write("Error");

I need the where condition after inserting values but how will i put that condition ? I got control parameter in source side like this ;
<InsertParameters>
        <asp:ControlParameter ControlID="Textbox1" Name="date1" Type="DateTime" PropertyName="Text" />
        <asp:ControlParameter ControlID="Textbox2" Name="date2" Type="DateTime" PropertyName="Text" />
        <asp:ControlParameter ControlID="DropDownList1" Name="name1" Type="String" PropertyName="Text" />
    </InsertParameters>

Waiting your answers.

A:

I asked this question more complicated and answered myself on this topic here ; Update Database with Conditions By Using C#

