Visual Studio 2010 UltimateのC#からMySQLのテーブルa(列は b と c のみで、bを主キーに設定し、データは2行あり)の内容をDataGridViewで表示は出来るが、
行削除、行挿入、行更新・変更して、保存アイコンをクリックすると、行削除の場合だと InvalidOperationExceptionはハンドルされませんでした。
Updateには、削除された行を含むDataRowコレクションが渡されたとき、有効なDeleteCommandが必要です。
と表示され、テーブルaの内容を更新する事が出来ません。Form1.csの内容は下記の通りです。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace m
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void aBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.aBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.testDataSet);
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: このコード行はデータを 'testDataSet.a' テーブルに読み込みます。
// 必要に応じて移動、または削除をしてください。
this.aTableAdapter.Fill(this.testDataSet.a);
}
}
}
宜しく御願い致します。以上