Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to insert two different data in different tables and both tables not join or link and then i wanted to see inserted data together in datagridview

What I have tried:

insert into article-production(code,name,weight)values(@code,@name,@weig‌​ht,(select buyer from setup where id =@id)
Posted
Updated 29-Jan-18 22:57pm
Comments
Afzaal Ahmad Zeeshan 30-Jan-18 5:29am    
That code of SQL is incorrect in itself, article-production does not let you execute two insert statements. You would require to execute two statements to do this.

1 solution

If it is a stored procedure just use two insert statements

SQL
insert into table1 (...) values (...)

insert into table2 (...) values (...)


We can't help you with your display issue as we don't know about your tables or what you want to show. We only know what you tell us, we can't access your code or your database and we can't read your mind.
 
Share this answer
 
Comments
Ali Khan 30-Jan-18 5:11am    
yea i use same query but both table data save in there particular table but when i wanted to show both table data in single datagridview then it show only one table data
F-ES Sitecore 30-Jan-18 5:32am    
That depends how you want the two tables to appear. You can only do what the underlying control supports, so if it supports master\child tables then do that, but if it only supports a single datasource you'll need to just JOIN the tables together to turn them into one big dataset.
Ali Khan 30-Jan-18 5:15am    
in my production table i have columns name as(article-code,article-id ,weight) and in my buyer table columns (buyer-code,buyer-id,buyer-name) now i wanted to save both table data together then show data in datatable gridview together
Afzaal Ahmad Zeeshan 30-Jan-18 5:28am    
5ed.

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