Click here to Skip to main content
15,936,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello I want to insert for same ID multiple values in a table.
For example:
STOCKID Serial
HP 1234232

STOCKID Serial
HP 3325235

STOCKID Serial
HP 3325235


What I have tried:

SELECT TOP (1000) [ID] >>PRIMARY KEY Auto increment
,[URUNID] >>
,[MODELID]
,[URUNSERINO]
,[SERIPROBLEM]
FROM [Stok-Kargo_Takip].[dbo].[SERI_NO_TABLO]

INSERT INTO SERI_NO_TABLO(URUNID,MODELID,URUNSERINO,SERIPROBLEM)
VALUES (@URUNID,@MODEL,@SERIAL,@SERIPROBLEM)


ID URUNID MODELID PROBLEM
1 PDA_MC9190 MC-9190 323464343 fmsdmfofodsfsd
2 PDA_MC9190 MC-9190 6364643643 amsokasndosando
3 PDA_MC9190 MC-9190 63464643 knfjdsnfjdsnfjdsn

I just want to see this result, when I insert from 3 textboxes for serials and 3 textboxes for problem explain with button click at the same time.

I tried with while loop but it goes to endless loop. I hope somebody can help me. Thank you
Posted
Updated 19-Jan-23 3:51am
Comments
Karthik_Mahalingam 30-Dec-22 1:30am    
create 3 insert statements for the values you are getting from the UI
hasan25x 30-Dec-22 11:00am    
Hello, thank you for your answer. How can I insert values with 3 insert statements?
I use visual studio for asp.net . I have 6 textboxes and 3 of them for serials, 3 of them for their problems. After check textboxes with button click event I want to see the result as above. ex: FOR same ID : HP 3 serials enter at the same time with button. I use store procedure.Thank you.
Karthik_Mahalingam 3-Jan-23 1:24am    
in the stored procedure pass all 6 variables and create 3 insert statement in the SP.
adriancs 1-Jan-23 7:51am    
Here's the problem you mentioned: "it goes to endless loop". But you didn't include code how you do it that cause the "endless loop". The SQL code that shown in the question is not causing the "endless loop". you have to provide more details.
hasan25x 3-Jan-23 1:08am    
Hi again, that's my problem. I mean I knot that ı have to do it with loop and textbox array.
I think ı have to create an array for textboxes and use it in for loop.
But I have also store procedure that means when I insert that I have to make it in store procedure.
I have a stock program.In a page I have two gridviews.First gridview shows StockID,Model,Quantity...
and second gridview shows StockID,Model,serials(Which relation with stock id from first grid.)
first gridview
HP i5 3 (QTY)(AT service for repair) Date....
CASPER i3 1 (QTY)(AT service for repair) Date....

Second gridview
HP i5 2112412421 (Delete button here row. When i click to button first Gridview QTY
decreasing )
HP i5 1242421424
HP i5 1421421421
CASPER i3 2532535323

1 solution

yes it is.

After each delete on the frontend you can just save to the db. then recalculate.
you would need to have a separate table to hold the counts for decreasing serials.

after each delete on the frontend. lookup on this table to get you the information you want.

use the primary ID for count on this table.

another thing.
don't use (1000) in the select. :(
 
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