Results 1 to 7 of 7

Thread: [RESOLVED] Update Statement

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2006
    Location
    USA
    Posts
    122

    Resolved [RESOLVED] Update Statement

    hi everyone. I am trying to execute an update statement. I have tried what seems like 20 different ways and nothing seems to be working. Can someone please tell me what i am doing wrong.

    int Employeenum = int.Parse(this.txtEmployeeNum.Text);
    string BranchName = this.cboBranch.Text;

    string sql = "update branch set num_employees = " + Employeenum + " where branch_name = '" + BranchName + "'";
    SqlCommand cmd = new SqlCommand(sql, conn);
    try
    {
    cmd.Connection.Open();
    cmd.ExecuteNonQuery();
    cmd.Connection.Close();
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message);
    }


    After that happens i get no update on the table and no errors.

    Last edited by Hack; Feb 14th, 2007 at 09:13 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width