Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
example :

suppose i have two table
1 as Employee
2 as Order

in this case i have enter the value in database through design part ,
so how can i write query for this error,

i have insert value in both table through one query.....
Posted
Comments
Ankit Rajput 27-Jun-11 8:16am    
What is the error?

SQL
insert blah into Employee; insert blah into Order; 


Notice the semi-colon separating the two statementes. It's "technically" two queries, but you can run them both with a single call to SqlCommand.ExecuteNonQuery().
 
Share this answer
 
Comments
[no name] 27-Jun-11 9:16am    
simple, but effective solution
You can use trigger
please look at this
this might help you
http://khanrahim.wordpress.com/2009/12/04/how-to-write-trigger-in-sql-server-2005/
thanks
Faisal
 
Share this answer
 
Execute a stored procedure from your code with the SqlCommand.
When you pass the correct parameters to your procedure, you can do the insert statements in here.

J.
 
Share this answer
 
Comments
[no name] 27-Jun-11 9:15am    
better option

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