0

アカウント番号を使用してアカウントのニックネームを更新するボタンを作成しようとしていますが、エラーが発生します。

ここに画像の説明を入力

  private void change_nickname_Click(object sender, EventArgs e)
    {
        try
        {
            connection.Open();
            OleDbCommand command = new OleDbCommand();
            command.Connection = connection;
            string query = "update customers set [CustomerCode]='" + customercode.Text + "',[CustomerName]='" + customername.Text + "',[Address]='" + customeraddress.Text + "',[PhoneNumber]='" + customerphone.Text + "',[Account]='" + Account + "',[AccountNickname]='" + accountnickname.Text + "',[Overdraft]='" + overdraft.Text + "' where AccountNumber=" + accountnumber.Text + "";
            MessageBox.Show(query);
            command.CommandText = query;

            command.ExecuteNonQuery();
            MessageBox.Show("Data updated successfuly!");
            connection.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error: " + ex);
        }
        connection.Close();
    }
4

1 に答える 1