how to insert newly datagrid values into database

Posted by Oswaldlily under VB.NET on 4/3/2014 | Points: 10 | Views : 515 | Status : [Member] | Replies : 1
I need to insert newly entering values into database..

So i m using Datagridview_Rowsadded which gets called even while screen gets load.

As a result,all old values in datagridview also gets inserted newly again & again...

How shall i avoid it by making insert possible only for newly entering values???????????????




Responses

Posted by: Vinothkumar on: 4/11/2014 [Member] Starter | Points: 25

Up
0
Down
Check it in db while inserting with some primary column..

IF EXISTS(SELECT 1 FROM TableName WHERE ID=@YouID)
--UPDATE
ELSE
--INSERT
END

Hope this helps you..


Regards,
Vinoth kumar

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response