First of all, I'm really new to Visual Studio and Asp.net C #, etc.
I am creating a simple bike rental app and just stuck.
I made a Formula to add order for one bike and made an insert into the submit button without any problems.
Now to my problem .. The same client can rent more bikes at the same time, and instead of filling out the Formula for each new bike again, I want to add more bikes to the same Formula (1 bike = serial number)
To do this, I found a solution on the Internet, where I took the Serial Number field and created a field in which the user fills in the number of bikes that the client wants to rent, and then a button next to the field. When the user then writes, for example, 3 in the quantity field and presses the button, he automatically pops up 3 text fields for entering each bike Serial number.
Now I need some solution to insert the value of these text fields with serial numbers.
After clicking the button that makes the insert on my SQL server, I have to do some loop to count the number of attachments that I need to make, and also print in different values โโof serial numbers for each order.
example: 1 customer 3 bikes bike 1 = Serial Number 123 bike 2 = Serial Number 234 bike 3 = Serial Number 345
Now I need to make 3 inserts with these 3 different serial numbers after clicking the submit button.
Am I on the right track?
protected void btnGenerateControl_Click(object sender, EventArgs e) { int Count = Convert.ToInt32(Qty.Text); for(int i =1; i <= Count; i++) { TextBox txtbox = new TextBox(); txtbox.Text = "Textbox - " + i.ToString(); pnlTextBoxes.Controls.Add(txtbox); } } protected void btnAddOrder_Click(object sender, EventArgs e) { int Count = Convert.ToInt32(Qty.Text); for (int i = 1; i <= Count; i++) { String query = "insert into Orders (CustID, OrderDate, Time, ProductID, ProjectID, Status, FlottenID)values('" + CustID.Text + "','" + OrderDate.Text + "','" + Time.Text + "','" + ProductID.Value + "','" + ProjectID.Value + "','" + Status.Value +"','" +HERE I NEED TO CATCH THE VALUE OF SERIAL NUMBER+ "')"; String query1 = "commit;"; DataLayer.DataConnector dat = new DataLayer.DataConnector("Provider=SQLOLEDB; data source=****;database=event;user ID=****;password=*****; Persist Security Info=False"); dat.DataInsert(query); dat.DataInsert(query1); } }