Last post Apr 04, 2012 11:37 AM by mm10
Apr 04, 2012 09:00 AM|MrReclusive|LINK
I am working on an internal website for our company, I have been asked to do something i have never done before.
I need to insert multiple records based on the amount of employees.
I am working on a work order form that allows you to select multiple employees for a job, and when you are done completing the form it needs to submit multiple records based on the amount of employees
the field i am inserting are: Service Date, Hours, Activity, Vehicle, Service performed, then Employee.
so if you have 2 employees selected i need to insert 2 records where service date, hours, activity, vehicle, and service performed are all the same, but record 1 has employee 1 and record 2 has employee 2.
this form has a minimum of 1 employee and a maximum of 4.
i am using either a SQLdatasource, or ObjectDatasource
Apr 04, 2012 09:50 AM|mm10|LINK
Are you using some control that is bound to a SQLdatasource or an ObjectDatasource or how do you implement your form? If you have some textboxes and a button, you can implement the logic of inserting two or more records in the click event handler of the
Apr 04, 2012 10:23 AM|MrReclusive|LINK
right now im using a formview, but if it would be easer I could do it difrently
Apr 04, 2012 11:37 AM|mm10|LINK
You can set the InsertCommand of the SQLDataSource to a stored procedure which takes the service date, hours, activity, vehicle, service performed and the amount of employees as input parameters and adds the rows.
SelectCommand="SELECT * FROM Employees"
InsertCommandType = "StoredProcedure"