hi guys,
I need some one to help me on how to insert multiple records in a table. I used multiple selct list box where in the user are allowed to choices as many as he/she can.
my problem is if it is multiple records it did not add to my table but is doesn't appear any error message.
here is my code
sql = "SELECT * FROM TRAINING WHERE STAFF_SK = "&session("staffsk")&" AND COURSE_NAME = '"&sqlsafe(course)&"' AND BRANCH = '"&sqlsafe(school)&"' AND START_DATE = #"&startdate&"#"
rs.open sql, cn
rs.close
For i = 0 To cInt(Request.Form("choices")) - 1
sql = "Insert into TRAINING (STAFF_SK, COURSE_NAME, BRANCH, START_DATE, PROVIDER_NAME, FUND_SOURCE, HOURS, DIRECT_COSTS, ERT_COSTS, SCHOOL_COSTS, BRANCH_COSTS, DEPARTMENT_SK, PROGRAM_TYPE) " & _
"VALUES ("&session("staffsk")&","&course&","&school&",#"&startdate&"#,"&provider&","&funding&","&hours&","&direct&","&ert&", "&schcst&","&brcst&" , "&department_sk&","&programtype&")"
next
'response.write sql
rs.open sql, cn
I need some one to help me on how to insert multiple records in a table. I used multiple selct list box where in the user are allowed to choices as many as he/she can.
my problem is if it is multiple records it did not add to my table but is doesn't appear any error message.
here is my code
sql = "SELECT * FROM TRAINING WHERE STAFF_SK = "&session("staffsk")&" AND COURSE_NAME = '"&sqlsafe(course)&"' AND BRANCH = '"&sqlsafe(school)&"' AND START_DATE = #"&startdate&"#"
rs.open sql, cn
rs.close
For i = 0 To cInt(Request.Form("choices")) - 1
sql = "Insert into TRAINING (STAFF_SK, COURSE_NAME, BRANCH, START_DATE, PROVIDER_NAME, FUND_SOURCE, HOURS, DIRECT_COSTS, ERT_COSTS, SCHOOL_COSTS, BRANCH_COSTS, DEPARTMENT_SK, PROGRAM_TYPE) " & _
"VALUES ("&session("staffsk")&","&course&","&school&",#"&startdate&"#,"&provider&","&funding&","&hours&","&direct&","&ert&", "&schcst&","&brcst&" , "&department_sk&","&programtype&")"
next
'response.write sql
rs.open sql, cn