Click here to Skip to main content
15,897,360 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
In single buttonclick event

i need to use a select and insert command .Is it possible
if possible send me an example please
Posted
Comments
OriginalGriff 2-Jul-13 11:54am    
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.
What the heck is a "Select and insert command"? The two operations are not the same: one retrieves information and the other adds it.
What are you actually trying to do?
Use the "Improve question" widget to edit your question and provide better information.
Sergey Alexandrovich Kryukov 2-Jul-13 13:24pm    
Click Improve question.
—SA

You can select a value from one table and insert those values in another table.

insert into tblname1([colname1, colname2, etc]) values(select [colname1,colname2, etc] from tblname2)

The values of colname1, colname2, etc will be taken from TABLE tblname2 and will be inserted into colname1, colname2, etc of TABLE tblname1

Or Improve your question for help us to understand what actually need.
 
Share this answer
 
Yes it is possible,

In the button click event you write some code that uses connection and command objects, such as SQLCommand and SQLConnection (found in the System.Data namespace) and construct the appropriate command (ideally using parametrised queries) to post stuff to your underlying database.
 
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