Click here to Skip to main content
15,917,859 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, i want to insert values at the same time for each row.
Stock ID | MODELID | Quantity
HP. İ3. 2

Stock ID |. Model | serialno
HP. İ3. 15142526
HP. İ3. 3637383388

I want to add at the same time for two databases. table.first insert I did it.but second part i can't do it.

What I have tried:

I tried to create datatable and with add.row for each row one serial number.. it is a stock program. I just can add one serial. But i want when i send them to service i should send two ör three stock with serials. Because it is easy to follow like that. I hope somebody can help me.
Updated 17-Jan-23 2:35am
hasan25x 7-Jan-23 9:42am    
I want to add that values with textbox.thank you.
Dave Kreskowiak 7-Jan-23 10:34am    
You haven't said anything about what the problem is you're having, nor shown the code you're using.

1 solution

It sounds like you're trying to insert multiple rows of data into two different tables at the same time, and that you've successfully inserted data into the first table but are having difficulty doing so for the second table. One way you could accomplish this is by using a transaction to ensure that both inserts occur at the same time and that if one fails, the other is rolled back. You could also use a stored procedure to insert the data into both tables at the same time. Additionally, you can use the bulk insert statement to insert multiple rows at the same time, instead of using add.row one by one.
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