IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP Discussion :

pb d'objet fermé


Sujet :

ASP

  1. #1
    Membre du Club
    Inscrit en
    Mai 2004
    Messages
    88
    Détails du profil
    Informations forums :
    Inscription : Mai 2004
    Messages : 88
    Points : 45
    Points
    45
    Par défaut pb d'objet fermé
    Bon j'ai pas mal d'objets ds mon pg, et j'ai des boucles, j'ai des erreurs car je ne dois pas les fermer au bon moment ou alors il faut peut etre les redefinir !!
    Enfin bon si qq peut m'éclairer !! Merci.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    <% @Language=VBSCRIPT %>
    <% Option Explicit %>
    <!--#include file = "ConnexionBaseDeDonnees.asp"-->
     
    <HTML>
    <%If Request("autretable")="Yes" Then%>
    	<BODY BgColor="#CCCCFF" Text="#0033FF" Link="#00A0FF" VLink="#00C0FF">
    		<FONT Face="Verdana" Size="4">	
    			<FORM METHOD=POST ACTION="EntreesFormulaire2.asp">
    				Nom de la table : 
    				<INPUT TYPE=TEXT NAME=nomtable size="20">
    				<P>
    				<INPUT TYPE=HIDDEN NAME=idapplication VALUE=<%=Cint(Request("idapplication"))%>>
    				<INPUT TYPE=SUBMIT VALUE="Valider">		
    			</FORM>	
    		</FONT>
    	</BODY>
    <%Else
     
    	'---Définition des constantes---'
    	Const adCmdTable = 2
    	Const adLockOptimistic = 3
     
    	'---Définition des variables---'
    	Dim objRS
    	Dim objRS2
    	Dim strSql
    	Dim strSql2
    	Dim iCurseur
    	Dim iIndex
    	Dim iIndex2
    	Dim iNbLignes
    	Dim iNbLignes2
    	Dim arrTables
    	Dim arrChamps
    	Dim arrTypeChamps
     
    	iIndex2 = 0
    	iIndex = 0
     
    	'---Creation de deux instances d'objet Recordset---'
    	Set objRS = Server.CreateObject("ADODB.Recordset")
    	Set objRS2 = Server.CreateObject("ADODB.Recordset")
     
    	'---Creation de deux requetes sql---'
    	strSql = "select fIdTable, tNomTable from tblCreationTable where fIdApplication = " & Cint(Request("idapplication"))
    	objRS.Open strSql, objConn, adLockOptimistic, adCmdTable
    	strSql2 = "select count(*) from tblCreationTable where fIdApplication = " & Cint(Request("idapplication"))
    	objRS2.Open strSql2, objConn, adLockOptimistic, adCmdTable
     
    	If objRS2(0) <> "" Then
    		iNbLignes = Cint(objRS2(0))-1
    		Redim arrTables(iNbLignes)
    		objRS.MoveFirst
    		Dim strSql3
    		Dim objRS3
    		Dim strSql4
    		Dim objRS4
    		Dim strIdTable
    		Dim strSql5
    		Dim objConn2
    		While not objRS.EOF
     
     
    			strIdTable = objRS.Fields("fIdTable").Value
    			arrTables(iIndex) = objRS.Fields("tNomTable").Value
    			Set objRS3 = Server.CreateObject("ADODB.Recordset")
    			Set objRS4 = Server.CreateObject("ADODB.Recordset")
     
    			'---Creation de deux requetes sql---'
    			strSql3 = "select tNomChamps, tTypeChamps from tblCreationChamps where fIdTable = " & strIdTable			
    			objRS3.Open strSql3, objConn, adLockOptimistic, adCmdTable
    			strSql4 = "select count(*) from tblCreationChamps where fIdTable = " & strIdTable
    			objRS4.Open strSql4, objConn, adLockOptimistic, adCmdTable
     
    			If objRS4(0) <> "" Then
    				iNbLignes2 = Cint(objRS4(0))-1
    				Redim arrChamps(iNbLignes2)
    				Redim arrTypeChamps(iNbLignes2)
    				objRS3.MoveFirst
    				iIndex2 = 0
    				While not objRS3.EOF
    					arrChamps(iIndex2) = objRS3.Fields("tNomChamps").Value
    					arrTypeChamps(iIndex2) = objRS3.Fields("tTypeChamps").Value
    					objRS3.MoveNext
    					iIndex2 = iIndex2 + 1
    				Wend
     
    				Set objConn2 = Server.CreateObject("ADODB.Connection")
    				objConn2.Open "base_generique"
    				Select Case arrTypeChamps(0)
    				Case "Texte", "Lien hypertexte"
    					strSql5 = "create table " & arrTables(iIndex) & " (" & arrChamps(0) & " text Primary Key"
    				Case "Numerique"
    					strSql5 = "create table " & arrTables(iIndex) & " (" & arrChamps(0) & " numeric Primary Key"
    				Case "Date/Heure"
    					strSql5 = "create table " & arrTables(iIndex) & " (" & arrChamps(0) & " datetime Primary Key"
    				Case "Oui/Non"
    					strSql5 = "create table " & arrTables(iIndex) & " (" & arrChamps(0) & " bit Primary Key"
    				End Select
    				iCurseur = 1
    				While iCurseur < iIndex2
    					Select Case arrTypeChamps(iCurseur)
    					Case "Texte", "Lien hypertexte"
    						strSql5 = strSql5 & ", " & arrChamps(iCurseur) & " text"					
    					Case "Numerique"
    						strSql5 = strSql5 & ", " & arrChamps(iCurseur) & " numeric"
    					Case "Date/Heure"
    						strSql5 = strSql5 & ", " & arrChamps(iCurseur) & " datetime"
    					Case "Oui/Non"
    						strSql5 = strSql5 & ", " & arrChamps(iCurseur) & " bit"	
    					End Select
    					iCurseur = iCurseur + 1
    				Wend
    				strSql5 = strSql5 & ")"
    				objConn2.Execute strSql5
    			End If
    			objRS.MoveNext
    			iIndex = iIndex + 1
    			objRS3.Close
    			Set objRS3 = Nothing
    			objRS4.Close
    			Set objRS4 = Nothing
    			objConn.Close
    			Set objConn = Nothing
    		Wend
    	End If
     
    	'---Elimination des objets ADO---'
    	objRS.Close
    	Set objRS = Nothing
    	objRS2.Close
    	Set objRS2 = Nothing
     
    End If
    objConn.Close
    Set objConn = Nothing
    %>
     
    </HTML>

  2. #2
    Membre émérite Avatar de franculo_caoulene
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    2 880
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 2 880
    Points : 2 953
    Points
    2 953
    Par défaut
    Ca plante à quelle ligne?

  3. #3
    Membre du Club
    Inscrit en
    Mai 2004
    Messages
    88
    Détails du profil
    Informations forums :
    Inscription : Mai 2004
    Messages : 88
    Points : 45
    Points
    45
    Par défaut
    à celle là, ligne 62 :
    Mais je pense en général que ce sont tous mes objets qui doivent etre fermés au mauvais moment !!

  4. #4
    Inactif
    Inscrit en
    Juillet 2002
    Messages
    315
    Détails du profil
    Informations forums :
    Inscription : Juillet 2002
    Messages : 315
    Points : 353
    Points
    353
    Par défaut
    tu fermes ta connection à la fin d'une boucle

  5. #5
    Membre du Club
    Inscrit en
    Mai 2004
    Messages
    88
    Détails du profil
    Informations forums :
    Inscription : Mai 2004
    Messages : 88
    Points : 45
    Points
    45
    Par défaut
    Oh la la la bourde !! C'est q j'ai oublié de rajouter 2 à cause d'un copier coller. J'avais trop le nez dedans je voyais rien. Merci en tt cas.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. SQL et VBA => objet fermé
    Par HurGeek dans le forum Développement
    Réponses: 1
    Dernier message: 24/05/2012, 16h21
  2. Réponses: 0
    Dernier message: 07/12/2009, 15h50
  3. Variable pointant sur un objet fermé
    Par azur668 dans le forum VBA Access
    Réponses: 2
    Dernier message: 03/08/2009, 12h27
  4. objet fermé ou supprimé
    Par harjer dans le forum VBA Access
    Réponses: 7
    Dernier message: 25/06/2007, 15h37
  5. Problème avec objet fermé
    Par Mvu dans le forum ASP
    Réponses: 4
    Dernier message: 22/09/2005, 10h30

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo