SQL delete command?

后端 未结 7 1220
死守一世寂寞
死守一世寂寞 2020-12-18 02:59

I am having trouble with a simple DELETE statement in SQL with unexpected results , it seems to add the word to the list??. Must be something silly!. but i cannot see it , t

7条回答
  •  长情又很酷
    2020-12-18 03:12

    See the code below:

    String queryForUpdateCustomer = "UPDATE  customer SET cbalance=@txtcustomerblnc WHERE cname='" + searchLookUpEdit1.Text + "'";
                try
                {
                    using (SqlCommand command = new SqlCommand(queryForUpdateCustomer, con))
                    {
    
                    command.Parameters.AddWithValue("@txtcustomerblnc", txtcustomerblnc.Text);
    
    
                    con.Open();
                    int result = command.ExecuteNonQuery();
    
                    // Check Error
                    if (result < 0)
                        MessageBox.Show("Error");
    
                    MessageBox.Show("Record Update of Customer...!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    con.Close();
    
                    loader();
                }
    
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                con.Close();
            }
    

提交回复
热议问题