Application.lock et adodb.recordset sous sql server
dedson
Messages postés6Date d'inscriptionvendredi 10 mai 2002StatutMembreDernière intervention 6 septembre 2002
-
8 août 2002 à 13:53
cs_miguel
Messages postés4Date d'inscriptionmercredi 12 juin 2002StatutMembreDernière intervention15 mai 2003
-
12 août 2002 à 09:36
salut à tous!
j'utilise la methode application.lock et application.unlock et j'obtines le message d'erreur suivant:
ADODB.Recordset erreur '800a0e78'
L'opération demandée par l'application n'est pas autorisée si l'objet est fermé.
Mon code est le suivant:
Application.Lock
'Inserts the data in the MemoCustomer table
SQLQueryU="INSERT INTO MemoCustomer (MemoCustomer_Email,MemoCustomer_Name,MemoCustomer_DateSub,MemoCustomer_EndSub) VALUES ('"&email&"','"&pseudo&"',getdate(),dateadd(mi,30,getdate()))"
set ResultU = dbconnect.Execute( SQLQueryU)
'selects max MemoCustomer ID
sqlmax = "SELECT max(MemoCustomer_ID) FROM MemoCustomer"
Set Resultmax = Server.CreateObject("ADODB.Recordset")
Resultmax.Open sqlmax,dbconnect, 3, 3
Session("MemoCustomer_ID") = Resultmax(0)
'Closes the recordset objects
If isobject(ResultT) Then
ResultT.Close
Set ResultT = Nothing
End If
If isobject(ResultU) Then
ResultU.Close
Set ResultU = Nothing
End If
If isobject(ResultC) Then
ResultC.Close
Set ResultC = Nothing
End If
If isobject(Resultmax) Then
Resultmax.Close
Set Resultmax = Nothing
End If
En fait j'essai de recuperer l'identifiant unique de mon client.Mi apparemment il y a un conflict entre l'objet application et le fait que je désire en principe après son utilistion fermer l'enregistrement.
Quelqu'un aurait t'il une solution à me proposer.
merci d'avance!
A voir également:
Application.lock et adodb.recordset sous sql server
cs_miguel
Messages postés4Date d'inscriptionmercredi 12 juin 2002StatutMembreDernière intervention15 mai 2003 12 août 2002 à 09:36
Ben je suis pas sur, mais il me semble que Application.Lock et Unlock ne marche que sur des variables d'application. Pour vérouiller ton accès, il faut donc tu utilises une variable d'application comme un sémaphore:
Par exemple
fin=false
while not fin=true
Application.Lock()
if (Application("bdd_libre")=true) then
Application("bdd_libre")=false
end if
Application.UnLock()
wend
........
.....traitement.......
..........