zekabyle
Messages postés28Date d'inscriptionlundi 6 mars 2006StatutMembreDernière intervention 2 janvier 2007
-
9 mai 2006 à 11:02
zekabyle
Messages postés28Date d'inscriptionlundi 6 mars 2006StatutMembreDernière intervention 2 janvier 2007
-
17 mai 2006 à 09:42
j'ai utilisé Cstr mais dans ma requête SQL j'ai une erreur de type 1 paramètre attendu:
TabPTFU(4,i) est un réel que je veux transformer en chaine
Voici un morceau du code:
TabPTFU(4,i)=CStr(TabPTFU(4,i))
SQLIngPTFU "UPDATE activitePTF SET act_nbjourpPTF '& TabPTFU(4,i) &' WHERE act_moi_moisPTF = '"& TabPTFU(0,i) &"' AND act_tac_codact = "& TabPTFU(1,i) &" AND act_ing_codingPTF = "& TabPTFU(2,i) &" AND act_con_codconPTF = "& TabPTFU(3,i) &" ;"
Set RSupdatePTFU = OBJdBportConn.Execute(SQLIngPTFU)
zekabyle
Messages postés28Date d'inscriptionlundi 6 mars 2006StatutMembreDernière intervention 2 janvier 2007 10 mai 2006 à 09:46
c'est juste une erreur dans l'écriture du champ act_tac_codactPTF car act_tac_codact ne fait pas partie de la table que j'utilise c une erreur de recopiage de champ.
Mais ça rame énormément quand j'exécute mon code.
J'utilise des bases access avec plus de 20400 lignes dans les tables concernées activitePTF et aussi activite. Je suis sûr que mon morceau de code n'est pas optimisé mais ça rame tellement que ça dépasse le délai de connexion imposé.
Voici mon code :
<%@ Language=VBScript %> <%@ Language=VBScript %> <%@ Language=VBScript %> <%@ Language=VBScript %> <!--#include file="includes/utils.asp"
--><%
dim i,j,k
'variable me permettant de me connecter à la base DispoPTF
dim OBJdBportConn
'phase 0
dim OBJdBConnPTFU
dim OBJdBConnPTFL
dim RSPTFU
dim TabPTFU
dim RSPTFL
dim TabPTFL
dim RSIngPTFU
dim TabIngPTFU
dim SQLIngPTFU
dim RSupdatePTFU
dim test
dim SQL
dim TabMAJ
'3)partie mise à jour de la table activitePTF
Set OBJdBConnPTFU = Server.CreateObject("ADODB.Connection")
OBJdBConnPTFU.Open cheminbaseDispoPTF_U
Set RSPTFU = OBJdBConnPTFU.Execute ("SELECT * FROM activite WHERE act_con_codcon <> 0;")
if not RSPTFU.EOF then
TabPTFU = RSPTFU.GetRows
end if
RSPTFU.Close
Set RSPTFU = nothing
OBJdBConnPTFU.Close
Set OBJdBConnPTFU = nothing
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'stockage dans un tableau
'DispoPTF et dispo
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabPTFU,2)
if RSIngPTFU("act_moi_moisPTF") = TabPTFU(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabPTFU(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabPTFU(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabPTFU(3,i) then
if RSIngPTFU("act_nbjourpPTF") <> TabPTFU(4,i) then
TabMAJ(0,j) = TabPTFU(0,i)
TabMAJ(1,j) = TabPTFU(1,i)
TabMAJ(2,j) = TabPTFU(2,i)
TabMAJ(3,j) = TabPTFU(3,i)
TabMAJ(4,j) = TabPTFU(4,i)
'TabMAJ(5,j) = TabPTFU(5,i)
'TabMAJ(6,j) = TabPTFU(6,i)
'TabMAJ(7,j) = TabPTFU(7,i)
redim preserve TabMAJ(8,k)
k = k + 1
j = j + 1
end if
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
'fermeture de la table INGENIEUR de la base dispo
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
'désalloue le tableau TabIngPort pour libérer de la mémoire
erase TabPTFU
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'mise à jour de la table activitePTF
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabMAJ,2)
if RSIngPTFU("act_moi_moisPTF") = TabMAJ(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabMAJ(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabMAJ(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabMAJ(3,i) then
TabMAJ(4,i) = CStr(TabMAJ(4,i))
'TabMAJ(5,i) = CStr(TabMAJ(5,i))
'TabMAJ(6,i) = CStr(TabMAJ(6,i))
'TabMAJ(7,i) = CStr(TabMAJ(7,i))
'on utilise la requête SQL de mise à jour dans la table activitePTF de la base dispoPTF
SQLIngPTFU "UPDATE activitePTF SET act_nbjourpPTF '"& test &"' WHERE act_moi_moisPTF = '"& TabMAJ(0,i) &"' AND act_tac_codactPTF = "& TabMAJ(1,i) &" AND act_ing_codingPTF = "& TabMAJ(2,i) &" AND act_con_codconPTF = "& TabMAJ(3,i) &";"
Set RSupdatePTFU = OBJdBportConn.Execute(SQLIngPTFU)
Set RSupdatePTFU = nothing
i = 0
exit for
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
erase TabMAJ
'fermeture de la table activitePTF de la base DispoPTF
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
%><!--#include file="includes/utils.asp"
--><%
dim i,j,k
'variable me permettant de me connecter à la base DispoPTF
dim OBJdBportConn
'phase 0
dim OBJdBConnPTFU
dim OBJdBConnPTFL
dim RSPTFU
dim TabPTFU
dim RSPTFL
dim TabPTFL
dim RSIngPTFU
dim TabIngPTFU
dim SQLIngPTFU
dim RSupdatePTFU
dim test
dim SQL
dim TabMAJ
'3)partie mise à jour de la table activitePTF
Set OBJdBConnPTFU = Server.CreateObject("ADODB.Connection")
OBJdBConnPTFU.Open cheminbaseDispoPTF_U
Set RSPTFU = OBJdBConnPTFU.Execute ("SELECT * FROM activite WHERE act_con_codcon <> 0;")
if not RSPTFU.EOF then
TabPTFU = RSPTFU.GetRows
end if
RSPTFU.Close
Set RSPTFU = nothing
OBJdBConnPTFU.Close
Set OBJdBConnPTFU = nothing
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'stockage dans un tableau
'DispoPTF et dispo
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabPTFU,2)
if RSIngPTFU("act_moi_moisPTF") = TabPTFU(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabPTFU(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabPTFU(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabPTFU(3,i) then
if RSIngPTFU("act_nbjourpPTF") <> TabPTFU(4,i) then
TabMAJ(0,j) = TabPTFU(0,i)
TabMAJ(1,j) = TabPTFU(1,i)
TabMAJ(2,j) = TabPTFU(2,i)
TabMAJ(3,j) = TabPTFU(3,i)
TabMAJ(4,j) = TabPTFU(4,i)
'TabMAJ(5,j) = TabPTFU(5,i)
'TabMAJ(6,j) = TabPTFU(6,i)
'TabMAJ(7,j) = TabPTFU(7,i)
redim preserve TabMAJ(8,k)
k = k + 1
j = j + 1
end if
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
'fermeture de la table INGENIEUR de la base dispo
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
'désalloue le tableau TabIngPort pour libérer de la mémoire
erase TabPTFU
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'mise à jour de la table activitePTF
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabMAJ,2)
if RSIngPTFU("act_moi_moisPTF") = TabMAJ(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabMAJ(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabMAJ(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabMAJ(3,i) then
TabMAJ(4,i) = CStr(TabMAJ(4,i))
'TabMAJ(5,i) = CStr(TabMAJ(5,i))
'TabMAJ(6,i) = CStr(TabMAJ(6,i))
'TabMAJ(7,i) = CStr(TabMAJ(7,i))
'on utilise la requête SQL de mise à jour dans la table activitePTF de la base dispoPTF
SQLIngPTFU "UPDATE activitePTF SET act_nbjourpPTF '"& test &"' WHERE act_moi_moisPTF = '"& TabMAJ(0,i) &"' AND act_tac_codactPTF = "& TabMAJ(1,i) &" AND act_ing_codingPTF = "& TabMAJ(2,i) &" AND act_con_codconPTF = "& TabMAJ(3,i) &";"
Set RSupdatePTFU = OBJdBportConn.Execute(SQLIngPTFU)
Set RSupdatePTFU = nothing
i = 0
exit for
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
erase TabMAJ
'fermeture de la table activitePTF de la base DispoPTF
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
%><!--#include file="includes/utils.asp"
--><%
dim i,j,k
'variable me permettant de me connecter à la base DispoPTF
dim OBJdBportConn
'phase 0
dim OBJdBConnPTFU
dim OBJdBConnPTFL
dim RSPTFU
dim TabPTFU
dim RSPTFL
dim TabPTFL
dim RSIngPTFU
dim TabIngPTFU
dim SQLIngPTFU
dim RSupdatePTFU
dim test
dim SQL
dim TabMAJ
'3)partie mise à jour de la table activitePTF
Set OBJdBConnPTFU = Server.CreateObject("ADODB.Connection")
OBJdBConnPTFU.Open cheminbaseDispoPTF_U
Set RSPTFU = OBJdBConnPTFU.Execute ("SELECT * FROM activite WHERE act_con_codcon <> 0;")
if not RSPTFU.EOF then
TabPTFU = RSPTFU.GetRows
end if
RSPTFU.Close
Set RSPTFU = nothing
OBJdBConnPTFU.Close
Set OBJdBConnPTFU = nothing
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'stockage dans un tableau
'DispoPTF et dispo
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabPTFU,2)
if RSIngPTFU("act_moi_moisPTF") = TabPTFU(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabPTFU(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabPTFU(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabPTFU(3,i) then
if RSIngPTFU("act_nbjourpPTF") <> TabPTFU(4,i) then
TabMAJ(0,j) = TabPTFU(0,i)
TabMAJ(1,j) = TabPTFU(1,i)
TabMAJ(2,j) = TabPTFU(2,i)
TabMAJ(3,j) = TabPTFU(3,i)
TabMAJ(4,j) = TabPTFU(4,i)
'TabMAJ(5,j) = TabPTFU(5,i)
'TabMAJ(6,j) = TabPTFU(6,i)
'TabMAJ(7,j) = TabPTFU(7,i)
redim preserve TabMAJ(8,k)
k = k + 1
j = j + 1
end if
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
'fermeture de la table INGENIEUR de la base dispo
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
'désalloue le tableau TabIngPort pour libérer de la mémoire
erase TabPTFU
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'mise à jour de la table activitePTF
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabMAJ,2)
if RSIngPTFU("act_moi_moisPTF") = TabMAJ(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabMAJ(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabMAJ(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabMAJ(3,i) then
TabMAJ(4,i) = CStr(TabMAJ(4,i))
'TabMAJ(5,i) = CStr(TabMAJ(5,i))
'TabMAJ(6,i) = CStr(TabMAJ(6,i))
'TabMAJ(7,i) = CStr(TabMAJ(7,i))
'on utilise la requête SQL de mise à jour dans la table activitePTF de la base dispoPTF
SQLIngPTFU "UPDATE activitePTF SET act_nbjourpPTF '"& test &"' WHERE act_moi_moisPTF = '"& TabMAJ(0,i) &"' AND act_tac_codactPTF = "& TabMAJ(1,i) &" AND act_ing_codingPTF = "& TabMAJ(2,i) &" AND act_con_codconPTF = "& TabMAJ(3,i) &";"
Set RSupdatePTFU = OBJdBportConn.Execute(SQLIngPTFU)
Set RSupdatePTFU = nothing
i = 0
exit for
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
erase TabMAJ
'fermeture de la table activitePTF de la base DispoPTF
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
%><!--#include file="includes/utils.asp"
--><%
dim i,j,k
'variable me permettant de me connecter à la base DispoPTF
dim OBJdBportConn
'phase 0
dim OBJdBConnPTFU
dim OBJdBConnPTFL
dim RSPTFU
dim TabPTFU
dim RSPTFL
dim TabPTFL
dim RSIngPTFU
dim TabIngPTFU
dim SQLIngPTFU
dim RSupdatePTFU
dim test
dim SQL
dim TabMAJ
'3)partie mise à jour de la table activitePTF
Set OBJdBConnPTFU = Server.CreateObject("ADODB.Connection")
OBJdBConnPTFU.Open cheminbaseDispoPTF_U
Set RSPTFU = OBJdBConnPTFU.Execute ("SELECT * FROM activite WHERE act_con_codcon <> 0;")
if not RSPTFU.EOF then
TabPTFU = RSPTFU.GetRows
end if
RSPTFU.Close
Set RSPTFU = nothing
OBJdBConnPTFU.Close
Set OBJdBConnPTFU = nothing
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'stockage dans un tableau
'DispoPTF et dispo
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabPTFU,2)
if RSIngPTFU("act_moi_moisPTF") = TabPTFU(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabPTFU(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabPTFU(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabPTFU(3,i) then
if RSIngPTFU("act_nbjourpPTF") <> TabPTFU(4,i) then
TabMAJ(0,j) = TabPTFU(0,i)
TabMAJ(1,j) = TabPTFU(1,i)
TabMAJ(2,j) = TabPTFU(2,i)
TabMAJ(3,j) = TabPTFU(3,i)
TabMAJ(4,j) = TabPTFU(4,i)
'TabMAJ(5,j) = TabPTFU(5,i)
'TabMAJ(6,j) = TabPTFU(6,i)
'TabMAJ(7,j) = TabPTFU(7,i)
redim preserve TabMAJ(8,k)
k = k + 1
j = j + 1
end if
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
'fermeture de la table INGENIEUR de la base dispo
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
'désalloue le tableau TabIngPort pour libérer de la mémoire
erase TabPTFU
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'mise à jour de la table activitePTF
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabMAJ,2)
if RSIngPTFU("act_moi_moisPTF") = TabMAJ(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabMAJ(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabMAJ(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabMAJ(3,i) then
TabMAJ(4,i) = CStr(TabMAJ(4,i))
'TabMAJ(5,i) = CStr(TabMAJ(5,i))
'TabMAJ(6,i) = CStr(TabMAJ(6,i))
'TabMAJ(7,i) = CStr(TabMAJ(7,i))
'on utilise la requête SQL de mise à jour dans la table activitePTF de la base dispoPTF
SQLIngPTFU "UPDATE activitePTF SET act_nbjourpPTF '"& test &"' WHERE act_moi_moisPTF = '"& TabMAJ(0,i) &"' AND act_tac_codactPTF = "& TabMAJ(1,i) &" AND act_ing_codingPTF = "& TabMAJ(2,i) &" AND act_con_codconPTF = "& TabMAJ(3,i) &";"
Set RSupdatePTFU = OBJdBportConn.Execute(SQLIngPTFU)
Set RSupdatePTFU = nothing
i = 0
exit for
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
erase TabMAJ
'fermeture de la table activitePTF de la base DispoPTF
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
%>
<%@ Language=VBScript %><!--#include file="includes/utils.asp"
--><%
dim i,j,k
'variable me permettant de me connecter à la base DispoPTF
dim OBJdBportConn
'phase 0
dim OBJdBConnPTFU
dim OBJdBConnPTFL
dim RSPTFU
dim TabPTFU
dim RSPTFL
dim TabPTFL
dim RSIngPTFU
dim TabIngPTFU
dim SQLIngPTFU
dim RSupdatePTFU
dim test
dim SQL
dim TabMAJ
'3)partie mise à jour de la table activitePTF
Set OBJdBConnPTFU = Server.CreateObject("ADODB.Connection")
OBJdBConnPTFU.Open cheminbaseDispoPTF_U
Set RSPTFU = OBJdBConnPTFU.Execute ("SELECT * FROM activite WHERE act_con_codcon <> 0;")
if not RSPTFU.EOF then
TabPTFU = RSPTFU.GetRows
end if
RSPTFU.Close
Set RSPTFU = nothing
OBJdBConnPTFU.Close
Set OBJdBConnPTFU = nothing
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'stockage dans un tableau
'DispoPTF et dispo
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabPTFU,2)
if RSIngPTFU("act_moi_moisPTF") = TabPTFU(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabPTFU(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabPTFU(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabPTFU(3,i) then
if RSIngPTFU("act_nbjourpPTF") <> TabPTFU(4,i) then
TabMAJ(0,j) = TabPTFU(0,i)
TabMAJ(1,j) = TabPTFU(1,i)
TabMAJ(2,j) = TabPTFU(2,i)
TabMAJ(3,j) = TabPTFU(3,i)
TabMAJ(4,j) = TabPTFU(4,i)
'TabMAJ(5,j) = TabPTFU(5,i)
'TabMAJ(6,j) = TabPTFU(6,i)
'TabMAJ(7,j) = TabPTFU(7,i)
redim preserve TabMAJ(8,k)
k = k + 1
j = j + 1
end if
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
'fermeture de la table INGENIEUR de la base dispo
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
'désalloue le tableau TabIngPort pour libérer de la mémoire
erase TabPTFU
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'mise à jour de la table activitePTF
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabMAJ,2)
if RSIngPTFU("act_moi_moisPTF") = TabMAJ(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabMAJ(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabMAJ(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabMAJ(3,i) then
TabMAJ(4,i) = CStr(TabMAJ(4,i))
'TabMAJ(5,i) = CStr(TabMAJ(5,i))
'TabMAJ(6,i) = CStr(TabMAJ(6,i))
'TabMAJ(7,i) = CStr(TabMAJ(7,i))
'on utilise la requête SQL de mise à jour dans la table activitePTF de la base dispoPTF
SQLIngPTFU "UPDATE activitePTF SET act_nbjourpPTF '"& test &"' WHERE act_moi_moisPTF = '"& TabMAJ(0,i) &"' AND act_tac_codactPTF = "& TabMAJ(1,i) &" AND act_ing_codingPTF = "& TabMAJ(2,i) &" AND act_con_codconPTF = "& TabMAJ(3,i) &";"
Set RSupdatePTFU = OBJdBportConn.Execute(SQLIngPTFU)
Set RSupdatePTFU = nothing
i = 0
exit for
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
erase TabMAJ
'fermeture de la table activitePTF de la base DispoPTF
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
%>Set OBJdBConnPTFU = Server.CreateObject("ADODB.Connection")
OBJdBConnPTFU.Open cheminbaseDispoPTF_U
Set RSPTFU = OBJdBConnPTFU.Execute ("SELECT * FROM activite WHERE act_con_codcon <> 0;")
if not RSPTFU.EOF then
TabPTFU = RSPTFU.GetRows
end if
RSPTFU.Close
Set RSPTFU = nothing
OBJdBConnPTFU.Close
Set OBJdBConnPTFU = nothing
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'redimension du tableau
TabMAJ redim TabMAJ(8,1)
'initialisation du tableau TabMAJ
TabMAJ(0,0) = ""
TabMAJ(1,0) = ""
TabMAJ(2,0) = ""
TabMAJ(3,0) = ""
TabMAJ(4,0) = ""
TabMAJ(5,0) = ""
TabMAJ(6,0) = ""
TabMAJ(7,0) = ""
k = 1
'stockage dans un tableau 'DispoPTF et dispo
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabPTFU,2)
if RSIngPTFU("act_moi_moisPTF") = TabPTFU(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabPTFU(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabPTFU(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabPTFU(3,i) then
if RSIngPTFU("act_nbjourpPTF") <> TabPTFU(4,i) then
TabMAJ(0,j) = TabPTFU(0,i)
TabMAJ(1,j) = TabPTFU(1,i)
TabMAJ(2,j) = TabPTFU(2,i)
TabMAJ(3,j) = TabPTFU(3,i)
TabMAJ(4,j) = TabPTFU(4,i)
redim preserve TabMAJ(8,k)
k = k + 1
j = j + 1
end if
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
'fermeture de la table INGENIEUR de la base dispo
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
'désalloue le tableau TabIngPort pour libérer de la mémoire
erase TabPTFU
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'mise à jour de la table activitePTF
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabMAJ,2)
if RSIngPTFU("act_moi_moisPTF") = TabMAJ(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabMAJ(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabMAJ(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabMAJ(3,i) then
TabMAJ(4,i) = CStr(TabMAJ(4,i)) 'on utilise la requête SQL de mise à jour dans la table activitePTF de la base dispoPTF SQLIngPTFU "UPDATE activitePTF SET act_nbjourpPTF '"& test &"' WHERE act_moi_moisPTF = '"& TabMAJ(0,i) &"' AND act_tac_codactPTF = "& TabMAJ(1,i) &" AND act_ing_codingPTF = "& TabMAJ(2,i) &" AND act_con_codconPTF = "& TabMAJ(3,i) &";"
Set RSupdatePTFU = OBJdBportConn.Execute(SQLIngPTFU)
Set RSupdatePTFU = nothing
i = 0
exit for
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
erase TabMAJ
'fermeture de la table activitePTF de la base DispoPTF
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
je suis désolé de mettre autant de lignes
merci
<%@ Language=VBScript %><%@ Language=VBScript %><!--#include file="includes/utils.asp"
--><%
dim i,j,k
'variable me permettant de me connecter à la base DispoPTF
dim OBJdBportConn
'phase 0
dim OBJdBConnPTFU
dim OBJdBConnPTFL
dim RSPTFU
dim TabPTFU
dim RSPTFL
dim TabPTFL
dim RSIngPTFU
dim TabIngPTFU
dim SQLIngPTFU
dim RSupdatePTFU
dim test
dim SQL
dim TabMAJ
'3)partie mise à jour de la table activitePTF
Set OBJdBConnPTFU = Server.CreateObject("ADODB.Connection")
OBJdBConnPTFU.Open cheminbaseDispoPTF_U
Set RSPTFU = OBJdBConnPTFU.Execute ("SELECT * FROM activite WHERE act_con_codcon <> 0;")
if not RSPTFU.EOF then
TabPTFU = RSPTFU.GetRows
end if
RSPTFU.Close
Set RSPTFU = nothing
OBJdBConnPTFU.Close
Set OBJdBConnPTFU = nothing
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'stockage dans un tableau
'DispoPTF et dispo
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabPTFU,2)
if RSIngPTFU("act_moi_moisPTF") = TabPTFU(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabPTFU(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabPTFU(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabPTFU(3,i) then
if RSIngPTFU("act_nbjourpPTF") <> TabPTFU(4,i) then
TabMAJ(0,j) = TabPTFU(0,i)
TabMAJ(1,j) = TabPTFU(1,i)
TabMAJ(2,j) = TabPTFU(2,i)
TabMAJ(3,j) = TabPTFU(3,i)
TabMAJ(4,j) = TabPTFU(4,i)
'TabMAJ(5,j) = TabPTFU(5,i)
'TabMAJ(6,j) = TabPTFU(6,i)
'TabMAJ(7,j) = TabPTFU(7,i)
redim preserve TabMAJ(8,k)
k = k + 1
j = j + 1
end if
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
'fermeture de la table INGENIEUR de la base dispo
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
'désalloue le tableau TabIngPort pour libérer de la mémoire
erase TabPTFU
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'mise à jour de la table activitePTF
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabMAJ,2)
if RSIngPTFU("act_moi_moisPTF") = TabMAJ(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabMAJ(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabMAJ(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabMAJ(3,i) then
TabMAJ(4,i) = CStr(TabMAJ(4,i))
'TabMAJ(5,i) = CStr(TabMAJ(5,i))
'TabMAJ(6,i) = CStr(TabMAJ(6,i))
'TabMAJ(7,i) = CStr(TabMAJ(7,i))
'on utilise la requête SQL de mise à jour dans la table activitePTF de la base dispoPTF
SQLIngPTFU "UPDATE activitePTF SET act_nbjourpPTF '"& test &"' WHERE act_moi_moisPTF = '"& TabMAJ(0,i) &"' AND act_tac_codactPTF = "& TabMAJ(1,i) &" AND act_ing_codingPTF = "& TabMAJ(2,i) &" AND act_con_codconPTF = "& TabMAJ(3,i) &";"
Set RSupdatePTFU = OBJdBportConn.Execute(SQLIngPTFU)
Set RSupdatePTFU = nothing
i = 0
exit for
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
erase TabMAJ
'fermeture de la table activitePTF de la base DispoPTF
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
%><!--#include file="includes/utils.asp"
--><%
dim i,j,k
'variable me permettant de me connecter à la base DispoPTF
dim OBJdBportConn
'phase 0
dim OBJdBConnPTFU
dim OBJdBConnPTFL
dim RSPTFU
dim TabPTFU
dim RSPTFL
dim TabPTFL
dim RSIngPTFU
dim TabIngPTFU
dim SQLIngPTFU
dim RSupdatePTFU
dim test
dim SQL
dim TabMAJ
'3)partie mise à jour de la table activitePTF
Set OBJdBConnPTFU = Server.CreateObject("ADODB.Connection")
OBJdBConnPTFU.Open cheminbaseDispoPTF_U
Set RSPTFU = OBJdBConnPTFU.Execute ("SELECT * FROM activite WHERE act_con_codcon <> 0;")
if not RSPTFU.EOF then
TabPTFU = RSPTFU.GetRows
end if
RSPTFU.Close
Set RSPTFU = nothing
OBJdBConnPTFU.Close
Set OBJdBConnPTFU = nothing
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'stockage dans un tableau
'DispoPTF et dispo
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabPTFU,2)
if RSIngPTFU("act_moi_moisPTF") = TabPTFU(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabPTFU(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabPTFU(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabPTFU(3,i) then
if RSIngPTFU("act_nbjourpPTF") <> TabPTFU(4,i) then
TabMAJ(0,j) = TabPTFU(0,i)
TabMAJ(1,j) = TabPTFU(1,i)
TabMAJ(2,j) = TabPTFU(2,i)
TabMAJ(3,j) = TabPTFU(3,i)
TabMAJ(4,j) = TabPTFU(4,i)
'TabMAJ(5,j) = TabPTFU(5,i)
'TabMAJ(6,j) = TabPTFU(6,i)
'TabMAJ(7,j) = TabPTFU(7,i)
redim preserve TabMAJ(8,k)
k = k + 1
j = j + 1
end if
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
'fermeture de la table INGENIEUR de la base dispo
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
'désalloue le tableau TabIngPort pour libérer de la mémoire
erase TabPTFU
'ouverture de la base DispoPTF
Set OBJdBportConn = Server.CreateObject("ADODB.Connection")
OBJdBportConn.Open cheminbaseDispoPTF
'ouverture de la table activitePTF de la base DispoPTF
Set RSIngPTFU = OBJdBportConn.Execute ("SELECT * FROM activitePTF WHERE act_con_codconPTF <> 0;")
'mise à jour de la table activitePTF
do while not RSIngPTFU.EOF
for i = 0 to ubound(TabMAJ,2)
if RSIngPTFU("act_moi_moisPTF") = TabMAJ(0,i) then
if RSIngPTFU("act_tac_codactPTF") = TabMAJ(1,i) then
if RSIngPTFU("act_ing_codingPTF") = TabMAJ(2,i) then
if RSIngPTFU("act_con_codconPTF") = TabMAJ(3,i) then
TabMAJ(4,i) = CStr(TabMAJ(4,i))
'TabMAJ(5,i) = CStr(TabMAJ(5,i))
'TabMAJ(6,i) = CStr(TabMAJ(6,i))
'TabMAJ(7,i) = CStr(TabMAJ(7,i))
'on utilise la requête SQL de mise à jour dans la table activitePTF de la base dispoPTF
SQLIngPTFU "UPDATE activitePTF SET act_nbjourpPTF '"& test &"' WHERE act_moi_moisPTF = '"& TabMAJ(0,i) &"' AND act_tac_codactPTF = "& TabMAJ(1,i) &" AND act_ing_codingPTF = "& TabMAJ(2,i) &" AND act_con_codconPTF = "& TabMAJ(3,i) &";"
Set RSupdatePTFU = OBJdBportConn.Execute(SQLIngPTFU)
Set RSupdatePTFU = nothing
i = 0
exit for
end if
end if
end if
end if
next
RSIngPTFU.movenext
loop
erase TabMAJ
'fermeture de la table activitePTF de la base DispoPTF
RSIngPTFU.Close
Set RSIngPTFU = nothing
'fermeture de la base DispoPTF
OBJdBportConn.Close
Set OBJdBportConn = nothing
%>
aieeeuuuuu
Messages postés698Date d'inscriptionjeudi 16 janvier 2003StatutMembreDernière intervention20 mai 20113 10 mai 2006 à 10:55
re,
alors premiere chose, ta serie de IF, tu peux les mettre ensemble en un seul IF. (IF ... AND ... AND... THEN)
ca ne sera pas vraiment plus rapide, mais plus lisible.
pour ce qui est du probleme de lenteur, est ce que tu as regardé quelle partie de ton code prenait le plus de temps ?
dans tous les cas, il me semble que les index n'existent pas sous access, mais je ne connais pas suffisement ce SGBDR pour pouvoir l'optimiser.
enfin dans tous les cas, a mon avis ce qui est long dans ton programme, c'est la boucle de mise a jour.
il y a peut etre moyen de faire autrement, mais pour ca il faut savoir ce qu'est censé faire ton programme.
peux tu nous expliquer brievement quel est le but ?
zekabyle
Messages postés28Date d'inscriptionlundi 6 mars 2006StatutMembreDernière intervention 2 janvier 2007 10 mai 2006 à 14:17
je dois mettre à jour une table activitePTF d'une base Access DispoPTF.mdb à partir d'une table activite d'une autre base Access PTF_U.mdb.
les champs représentent les mêmes choses mais n'ont pas les mêmes noms,
j'ai 4 clés primaires avec possibilité de doublons qui sont les quatre premiers champs cités
.
table activitePTF:
act_moi_moisPTF :texte
act_tac_codactPTF:Entier
act_ing_codingPTF:Entier
act_con_codconPTF:Entier
act_nbjourpPTF:texte
act_nbjourfPTF:texte
act_prix_ventePTF:texte
act_prix_achatPTF:texte
table activite:
act_moi_mois :texte
act_tac_codact:Entier
act_ing_coding:Entier long
act_con_codcon:Entier long
act_nbjourp:réel
act_nbjourf:réel
act_prix_vente:réel
act_prix_achat:réel
ce qui m'intéresse est de mettre à jour act_nbjourpPTF à partir de act_nbjourp et je pense que je vais m'intéresser aux dates de la même année que la date actuelle.
aieeeuuuuu
Messages postés698Date d'inscriptionjeudi 16 janvier 2003StatutMembreDernière intervention20 mai 20113 10 mai 2006 à 18:08
ok,
dans access tu as la possibilité d'ajouter une table liée.
en fait, c'est une sorte de lien vers une table d'une autre base de données. ensuite ca te permet d'acceder a cette table comme si elle etait dans la base de données sur laquelle tu travaille.
je ne sais pas ce que ca peut donner niveau temps d'execution, mais je pense que tu peux essayer de faire ca, puis de faire tes mises a jour avec une seule requete comme si tes deux tables etaient dans la meme base de données
zekabyle
Messages postés28Date d'inscriptionlundi 6 mars 2006StatutMembreDernière intervention 2 janvier 2007 17 mai 2006 à 09:42
je garde dans un tableau les valeurs de ma table puis,
au lieu de comparer les valeurs de la table au tableau, j'ai comparé le tableau aux valeurs de la table puis j'ai testé d'abord si il y a fin de fichier puis je mets à jour avec update en mettant dans le WHERE là où je veux mettre à jour.Bien sûr j'ouvre les bases et je les ferme quand je n'en ai plus besoin(j'avais trois bases Access qui m'avaient été imposé à utiliser, la base que je dois mettre à jour contient les données des deux autres bases que j'utilise pour mettre à jour).
Server.ScriptTimeout pour changer le délai maximum d'un script.