I have a table Vegetables. It has 3 columns Id, Name, Price.
It contains 3 records.
Id Name Price
1 Potato 25
2 Onion 23
3 Ladyfinger 50
There is a GridView in the page where i am displaying the records.
Now there are 3 TextBoxes for Id, Name and Price
and a Button.
When i fill Id, Name and price TextBox record should be inserted or updated in the TextBox.
If the Id doesn't exist then new record should be inserted else the record will be updated based on the Id.
Example
Id - 2
Name - Drumstick
Price - 100
Then the result should be
Id Name Price
1 Potato 25
2 Drumstick 100
3 Ladyfinger 50
Id - 4
Name - Drumstick
Price - 100
Then the result should be
Id Name Price
1 Potato 25
2 Onion 23
3 Ladyfinger 50
4 Drumstick 100