Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using c# and an entity relationship layer to write to my database.

I would like to write a value in a text box to a table in my database multiple times.


The amount can be specified in the webform.

e.g.
txtbox1= insert product code 555
txtbox2 = the amount of times I want to insert product code 555 to the table.
btnCLick= Writes the product code a specific amount of times dependent on txtbox2

The table has the following fields:
StockID,ProductID
stockID - Auto increment So if I write ProductID it will assign a stock ID.

I want to know how to write 10(this can be any value) productIDs to the stock table in one transaction.


Any advice would be much appreciated!

JC
Posted
Comments
RakeshMeena 1-Jun-11 8:00am    
Why do you post same question multiple times?

One way is to pass the values to a stored procedure as an a array. Here is one way to do this: Passing an Array of Values to a Stored Procedure in SQL Server 2005[^].

If you follow up on this link you should find plenty of other examples.
 
Share this answer
 
This is the 3rd time you have asked this question. You have received good answers to both of your previous ones and now this one has even another good answer. Please look at those. If you have further questions directly related to a previous one, use the "Improve Question" link and update an existing question so the context of your question doesn't get lost.
Cheers.
 
Share this answer
 
Comments
Member 7949758 1-Jun-11 8:28am    
I appreciate that, and for that I am sorry.

All the suggestions I have been Given do not help me. I think this is due to my explanation of the problem.

I know how to Add a product to the database, I have also created a web form which will allow for me to manually add a product as many times as I want. What I dont know, is how to determine a specific amount of times to add the product.

maybe if I describe the controls I am using it will make it clearer.

On the aspx page I would have the following controls:

txtbox1= insert product code 555
txtbox2 = the amount of times I want to insert product code 555 to the table.
btnCLick= Writes the product code a specific amount of times dependent on txtbox2

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