- La prossima volta usa il tag [ CODE ] per inserire il codice.
- I campi li devi leggere all'interno del ciclo
- è inutile creare tutti quei recorset
- è inutile creare tante variabili sql diverse
- non aprire echiudere i tag asp (<% %>) in continuazione se è tutto codice asp
Prova a vedere se così va. Poi al massimo vediamo di capire esattamente cosa vuoi fare
codice:
<%
Set OBJdbConnection = Server.CreateObject("ADODB.Connection")
OBJdbConnection.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("prenotazioni.mdb")
sql = "SELECT * FROM tblUsers"
Set RS=OBJdbConnection.Execute(sql)
Do while NOT RS.EOF
IDUser=rs("IDUser")
UserID=rs("UserID")
Password=rs("Password")
permission=rs("permission")
Insegnamento=rs("Insegnamento")
Docente=rs("Docente")
Anno=rs("Anno")
Telefono=rs("Telefono")
Email=rs("Email")
NID=rs("NID")
Insegnamento2=rs("Insegnamento2")
Insegnamento3=rs("Insegnamento3")
Insegnamento4=rs("Insegnamento4")
Insegnamento5=rs("Insegnamento5")
Insegnamento6=rs("Insegnamento6")
Insegnamento7=rs("Insegnamento7")
Insegnamento8=rs("Insegnamento8")
Insegnamento9=rs("Insegnamento9")
Insegnamento10=rs("Insegnamento10")
i=i+1
if Insegnamento <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento&"')"
OBJdbConnection.Execute(sql)
end if
if Insegnamento2 <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento2&"')"
OBJdbConnection.Execute(sql)
end if
if Insegnamento3 <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento3&"')"
OBJdbConnection.Execute(sql)
end if
if Insegnamento4 <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento4&"')"
OBJdbConnection.Execute(sql)
end if
if Insegnamento5 <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento5&"')"
OBJdbConnection.Execute(sql)
end if
if Insegnamento6 <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento6&"')"
OBJdbConnection.Execute(sql)
end if
if Insegnamento7 <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento7&"')"
OBJdbConnection.Execute(sql)
end if
if Insegnamento8 <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento8&"')"
OBJdbConnection.Execute(sql)
end if
if Insegnamento9 <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento9&"')"
OBJdbConnection.Execute(sql)
end if
if Insegnamento10 <> "-" then
sql="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento10&"')"
OBJdbConnection.Execute(sql)
end if
RS.MoveNext
Loop
RS.Close
OBJdbConnection.Close
%>
ciao