Salve,
devo ricavare più campi di uno stesso record di una tabella access, e metterli in un'altra tabella access accodati l'uno all'altro, ma il seguente codice asp non funziona:
<%
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)
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")%>
<%Do while NOT RS.EOF
i=i+1%>
<%if Insegnamento <> "-" then%>
<%
sql1="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento&"')"
Set RS1=OBJdbConnection.Execute(sql1)
%>
<%end if%>
<%if Insegnamento2 <> "-" then%>
<%
sql2="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento2&"')"
Set RS2=OBJdbConnection.Execute(sql2)
%>
<%end if%>
<%if Insegnamento3 <> "-" then%>
<%
sql3="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento3&"')"
Set RS3=OBJdbConnection.Execute(sql3)
%>
<%end if%>
<%if Insegnamento4 <> "-" then%>
<%
sql4="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento4&"')"
Set RS4=OBJdbConnection.Execute(sql4)
%>
<%end if%>
<%if Insegnamento5 <> "-" then%>
<%
sql5="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento5&"')"
Set RS5=OBJdbConnection.Execute(sql5)
%>
<%end if%>
<%if Insegnamento6 <> "-" then%>
<%
sql6="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento6&"')"
Set RS6=OBJdbConnection.Execute(sql6)
%>
<%end if%>
<%if Insegnamento7 <> "-" then%>
<%
sql7="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento7&"')"
Set RS7=OBJdbConnection.Execute(sql7)
%>
<%end if%>
<%if Insegnamento8 <> "-" then%>
<%
sql8="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento8&"')"
Set RS8=OBJdbConnection.Execute(sql8)
%>
<%end if%>
<%if Insegnamento9 <> "-" then%>
<%
sql9="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento9&"')"
Set RS9=OBJdbConnection.Execute(sql9)
%>
<%end if%>
<%if Insegnamento10 <> "-" then%>
<%
sql10="INSERT INTO tblModuli (Moduli) VALUES('"&Insegnamento10&"')"
Set RS10=OBJdbConnection.Execute(sql10)
%>
<%end if%>
<%
RS.MoveNext
Loop
RS.Close
OBJdbConnection.Close%>

praticamente inserisce solo Insegnamento n volte nel campo Moduli.

Cìè un'altro modo per leggere dei dati da un database e inserirli di nuovo in un'altra tabella?
Grazie.