I have a tables Cars and CarDescriptions
cars: IDCar(int, PK, autoincrement) carsDesciptions(IDDescription, Header(nvarchar),Content(nvarchar),idCar(int,FK)
In application I am adding cars and editing existing ones.
My problems:
1.How to save changed Car with descriptions in database ??
I have ID of Car, and I have ID's of Descriptions
Class CarDescirption doesn't have any pool like IsChanged, so
I don't wanna do something like :
- delete from carsdescriptions where idcar=@idcar
- insert into cardescriptions (, @Header,@Content,@IDCar)
the record must be updated if is in table, and inserted if doesn't exist in table