テーブルから行を削除する必要があるアプリケーションがありますClient
public void Delete_Client(int _id_client)
{
Data.Connect();
using (Data.connexion)
{
string s = "Delete From CLIENT where id_client = " + _id_client;
SqlCommand command = new SqlCommand(s, Data.connexion);
try
{
command.ExecuteNonQuery();
}
catch { }
}
}
テーブルClient
には、別のテーブルへの外部参照が含まれています。そのため、削除がカスケードでなければならないことを示す例外が表示されます。
では、これを行うためにコードを変更するにはどうすればよいですか (SQL サーバーを dbms として使用しています)。