private void dgTeamList_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
SqlConnection conn = new SqlConnection ();
conn.ConnectionString =
"integrated security=SSPI;data source=localhost;" +
"persist security info=False;user=Dana;password=J34iQ198;initial catalog=XYZ Tech Group";
dgTeamList.EditItemIndex = e.Item.ItemIndex;
int EmpID = Convert.ToInt32(dgTeamList.DataKeys[e.Item.ItemIndex]);
System.Web.UI.WebControls.TextBox TeamID = new System.Web.UI.WebControls.TextBox();
TeamID = (System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0];
SqlCommand myCommand = new SqlCommand();
myCommand.CommandText = "UPDATE dsMembers1 SET TeamID = @TeamID WHERE EmpID = @EmpID";
myCommand.Parameters.Add(new SqlParameter("@TeamID",SqlDbType.Int,4));
myCommand.Parameters.Add(new SqlParameter("@EmpID",SqlDbType.Int,4));
myCommand.Parameters["@EmpID"].Value = EmpID;
myCommand.Parameters["@TeamID"].Value = null;
conn.Open();
myCommand.ExecuteNonQuery();
conn.Close();
dgTeamList.EditItemIndex = -1;
dgTeamList.DataBind();
dgBenched.DataBind();
}
I know I have everything I am supposed to have but I cannot figure out what I am doing wrong here. Please help.
I ran a test to see if I was getting anything in the variable EmpID and it came back blank, if that helps.
This post has been edited by Misguided: 11 September 2007 - 08:47 AM

New Topic/Question
Reply




MultiQuote



|