Ciao ragazzi buon S.Stefano a tutti
Ho un problemino con l'aggiornamento del database ma prima del problema vi dico cos'ho
ho un database DB.mdb
contenente 7 tabelle
con nome Lunedi,Martedi ecc. fino a Domenica
dentro a Lunedi ci sono i campi:
ID_Lunedi
nome
tipo
indirizzo
anngiornolunF
anngiornolunV
annseralunF
annseralunV
annnottelunF
annnottelunV
nella Martedi i campi:
ID_Martedi
nome
tipo
indirizzo
anngiornomarF
anngiornomarV
annseramarF
annseramarV
annnottemarF
annnottemarV
E così via in tutte le 7 tabelle
Ho una pagina modulo.asp che contiene il form con Repeat
Che visualizza tanti "input text" quanti sono i record con quel nome
sottolineo con il nome ,e non con l'id ,perchè appunto devo poter modificare i vari record di quel nome
Poi ho una pagina update.aspcodice:<% Dim Rbgl Dim Rbgl_cmd Dim Rbgl_numRows Set Rbgl_cmd = Server.CreateObject ("ADODB.Command") Rbgl_cmd.ActiveConnection = MM_conn_STRING Rbgl_cmd.CommandText = "SELECT * FROM Lunedi WHERE nome = '"&Session("MM_nome")&"'" Rbgl_cmd.Prepared = true Rbgl_cmd.Parameters.Append Rbgl_cmd.CreateParameter("param1", 200, 1, 255, Rbgl__MMColParam) Set Rbgl = Rbgl_cmd.Execute Rbgl_numRows = 0 %> <% Dim Repeatbgl__numRows Dim Repeatbgl__index Repeatbgl__numRows = -1 Repeatbgl__index = 0 Rec2_numRows = Rec2_numRows + Repeatbgl__numRows %> <form action="update.asp" method="POST" name="form" > Giorno<input name="ora" type="checkbox" value="Giorno" /> Sera<input name="ora" type="checkbox" value="Sera" /> Notte<input name="ora" type="checkbox" value="Notte" /> Lunedi <input name="check" type="checkbox" value="Lunedi" /> Martedi<input name="check" type="checkbox" value="Martedi" /> Mercoledi<input name="check" type="checkbox" value="Mercoledi" /> Giovedi<input name="check" type="checkbox" value="Giovedi" /> Venerdi<input name="check" type="checkbox" value="Venerdi" /> Sabato<input name="check" type="checkbox" value="Sabato" /> Domenica<input name="check" type="checkbox" value="Domenica" /> <% While ((Repeatbgl__numRows <> 0) AND (NOT Rec2.EOF)) %> <input type="text" name="annuncio" size="32" /> <input type="text" name="annunciov" size="32" /> <% Repeatbgl__index=Repeatbgl__index+1 Repeatbgl__numRows=Repeatbgl__numRows-1 Rec2.MoveNext() Wend %> <input type="submit" value="Aggiorna record" /> </form>
Dove ho il mio problema
Qua non so come identificare i vari input text (annuncio e annunciov) che arrivano dal form ovviamente solo se il campo nome ha piu recordcodice:<% if instr(ora,"Giorno")>0 THEN IF INSTR(spunte,"Lunedi" )>0 then strCode1g="pass" Set Conn=Server.CreateObject("ADODB.Connection") strConn="driver={Microsoft Access Driver (*.mdb)}; " strConn=strConn & " DBQ=" & Server.MapPath("\database/DB.mdb") strConn=strConn & ";pwd=" & strCode1g Conn.Open strConn sql = "UPDATE Lunedi " sql = sql & " SET anngiornolunF = '" & request.form("annuncio") & "' " sql = sql & ", anngiornolunV = '" & request.form("annunciov") & " '" sql = sql & " WHERE ID= "&Session("MM_ID")&"" Response.Write " MaGGica sql...: " & sql Response.Flush Conn.Execute (sql) conn.Close set conn = Nothing end if end if %> <% IF INSTR(ora,"Sera")>0 then IF INSTR(spunte, "Lunedi")>0 then strCode1g="pass" Set Conn=Server.CreateObject("ADODB.Connection") strConn="driver={Microsoft Access Driver (*.mdb)}; " strConn=strConn & " DBQ=" & Server.MapPath("\database/DB.mdb") strConn=strConn & ";pwd=" & strCode1g Conn.Open strConn sql = "UPDATE Lunedi " sql = sql & " SET annseralunF = '" & request.form("annuncio") & "' " sql = sql & ", annseralunV = '" & request.form("annunciov") & " '" sql = sql & " WHERE ID= "&Session("MM_ID")&"" Response.Write " MaGGica sql...: " & sql Response.Flush Conn.Execute (sql) conn.Close set conn = Nothing end if end if %> <% IF INSTR(ora,"Notte")>0 then IF INSTR(spunte, "Lunedi")>0 then --------Codice di aggiornamento end if end if %> <% IF INSTR(spunte, "Martedi")>0 THEN IF INSTR(ora, "Giorno")>0 THEN --------Codice di aggiornamento end if end if %> <% IF INSTR(spunte, "Martedi")>0 THEN IF INSTR(ora, "Sera")>0 THEN --------Codice di aggiornamento end if end if %> <% IF INSTR(spunte, "Martedi")>0 THEN IF INSTR(ora, "Notte")>0 THEN --------Codice di aggiornamento end if end if %>
Ho provato anche a modificare il database DB.mdb
facendo una tabella Utenti e una annunci,quindi 2 tabelle
In questo modo:
Tabella Utenti
ID
tipo
nome
indirizzo
Tabella Annunci
id_Annunci
id_utenti
anngiornolunF
anngiornolunV
annseralunF
annseralunV
annnottelunF
annnottelunV
anngiornomarF
anngiornomarV
annseramarF
annseramarV
annnottemarF
annnottemarV
anngiornomercF
anngiornomercV
annseramercF
annseramercV
annnottemercF
annnottemercV
anngiornogioF
anngiornogioV
annseragioF
annseragioV
annnottegioF
annnottegioV
ecc ecc. fino a dom
Ma alla fine ho lo stesso problema nel identificare i vari record prodotti dal form
:master:


:master:
Rispondi quotando