Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to posssible to write insert update query on single button click event
Posted
Comments
OriginalGriff 26-Jul-12 5:07am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
rockpune 26-Jul-12 5:12am    
i have one form in that two textboxs and one save button

in form2 datagridview and two buttons one is save another update i have to update datagridview selected row value how can i do that?
OriginalGriff 26-Jul-12 5:19am    
No need to apologise - it's just that we need information in order to answer. :laugh:

you will need primary key for record..check if already exists(by first selecting matching record,if count >1 then update ,else insert ...
 
Share this answer
 
Comments
rockpune 26-Jul-12 5:20am    
yes i keep primary key for that table the wat can i do plz give me one example
Hi,

Was busy so couldnot reply.

Still has problem ?

Use following logic

In stored procedure

Take parameter that will retrive unique records from Database.e.g. Email Id or Mobile Number like

1. from procedure parameter,fire select query with id (primary key returned like )
declare id;
select @id=id from students where email_id=@email_id

2. check if id exists ,if it is then it is update else it is insert

if(@id>1)
update
else
insert

Hope this clarifies you
 
Share this answer
 
This tip[^] may help you to understand how it can be done via stored procedure.
 
Share this answer
 

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