Deleting Existing Items
And finally, if you wish to delete an item from the relational database table, simply build a LINQ
query to locate the item you are no longer interested in, and remove it from the correct Table
member variable of the DataContext using the DeleteOnSubmit() method. Once you have done so,
again call SubmitChanges():
static void DeleteCar(AutoLotObjectsDataContext ctx)
{
int carToDelete = 0;
Console.Write("Enter ID of car to delete: ");
carToDelete = int.Parse(Console.ReadLine());
Do'stlaringiz bilan baham: