Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi I have a txtKodeITem and a DGPembelian.
*DGVPembelian (DatagridView)

The question:

How to do this logic when I click btnsave :
If txtKodeitem = DGVPEmbelian then
not add new row again but do update tblPembelian.
Sorry have not good speaking english.
Please understand.
Posted
Updated 3-Oct-13 16:03pm
v2
Comments
ZurdoDev 3-Oct-13 21:56pm    
I don't understand. If you want to check if a record exists then use IF EXISTS() in SQL. IF EXISTS() then do UPDATE otherwise do INSERT
irwan sesab 3-Oct-13 22:01pm    
I Mean. When I click btnSave than he check value on datagrid. If found then datagrid not add new row
ZurdoDev 3-Oct-13 22:05pm    
So, where are you stuck?
irwan sesab 3-Oct-13 22:11pm    
how to make the datagrid not add new row?
Manoj K Bhoir 6-Oct-13 9:35am    
Don't make any DataGrid, it's already made by Microsoft :)
You just have to check Whether Value you are inserting into the Database is already Present or Not on your btnSave Button before Saving the Record. If record is already present then just Update the record otherwise insert the same record. Now to check record exist or not you have to execute some queries on your Database and I hope you have the basic knowledge of Database otherwise Google is your friend.
Best Of Luck :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900