Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Langages serveur > ASP
ASP Forum sur la programmation ASP. Avant de poster : Cours ASP, FAQ ASP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 12/10/2007, 00h38   #1
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 48
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 48
Points : 11
Points : 11
Par défaut Problème avec du code asp

Bonjours à tous

J'ai un petit problème ave un script en ASP voici un erreur que j'obtien

Code :
1
2
3
4
5
Microsoft JET Database Engine erreur '80040e14' 
 
Erreur de syntaxe (virgule) dans l'expression 'j=11, 24 and m=10, 2 and a=2007, 2005 and element='a104' and annule=false'. 
 
/chenebleu/informatique/images/cardinal112/reservelocal/ok.asp, ligne 154
Explication:

Je dois développez un script qui ajoute un enregistrement à ma base de donnée et lorsque on appuie sur un boutton, un autre champ apparait.

Quand j'envoie une requête sans ajouter de champ tout fonctionne super bien

Je vous montre le code qui cause problème... Selon moi ...

Code :
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
<%
 
 
...
 
if instr(j,",")>0 then
 
 
j= Split(j,",", -1, 1)
m= Split(m,",", -1, 1)
a= Split(a,",", -1, 1)
 
 
For i = 0 to Ubound(i) step 1
 
%>
 
 
 
 
 
<%
 
next
end if
%>

Et finalement voici le code de connexion à la base de donnée aux alentours de la ligne 154:

Code :
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
<%
 
 
 
dsn ="DBQ="&Server.Mappath("./db/resa.mdb")&";Driver={Microsoft Access Driver(*.mdb)};"
 
 
 
 
dsn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("./db/xxxxxxxxxxxxxxxxxx.mdb")&";"
 
 
' VERIFIE SI L'ÉLÉMENT À DÉJA ÉTÉ RÉSERVÉ
 
response.buffer = true
'declaration
dim useraction
dim conn,dsn,rs,sql
'if the user submit the form
 
useraction = request("action")
 
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open dsn
SQL = "SELECT *  FROM reservation WHERE j=" & j & "  and m=" & m & " and a=" &  a & " and element='" & elements & "' and annule=false order by element ASC"
rs.open sql,conn
 
	if Not RS.EOF then
	isP1 = false
	isP2 = false
	isMidi = false
	isP3 = false
	isP4 = false
	isSoir = false
	Do While Not RS.EOF
		if RS("periode1") then
			isP1=true
		end if
		if RS("periode2") then
			isP2=true
		end if
		if RS("midi") then
			isMidi=true
		end if
		if RS("periode3") then
			isP3=true
		end if
		if RS("periode4") then
			isP4=true
		end if
		if RS("soiree") then
			isSoir=true
		end if
		RS.MoveNext
	loop
	end if
	isResValide = true
	if isP1 and peri1 = "on" then
		isResValide = false
	end if
	if isP2 and peri2 = "on" then
		isResValide = false
	end if
	if isMidi and midi = "on" then
		isResValide = false
	end if
	if isP3 and peri3 = "on" then
		isResValide = false
	end if
	if isP4 and peri4 = "on" then
		isResValide = false
	end if
	if isSoir and soir = "on" then
		isResValide = false
	end if
'if rs.eof and rs.bof then
if isResValide then
	Randomize()
	intRangeSize = 9999999 - 1000000 + 1
	sngRandomValue = intRangeSize * Rnd()
	sngRandomValue = sngRandomValue + intLowerBound
	cle = Int(sngRandomValue)
	Session("SID") = cle
%>
tidus666x est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/10/2007, 08h34   #2
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 850
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 850
Points : 5 966
Points : 5 966
Salut,

Il faut que tu choisisses lequel des deux tu veux utiliser:
Code :
1
2
3
 
dsn ="DBQ="&Server.Mappath("./db/resa.mdb")&";Driver={Microsoft Access Driver(*.mdb)};"
dsn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("./db/xxxxxxxxxxxxxxxxxx.mdb")&";"
Le premier devrait suffire. Sinon, jette un oeil à ce post.

A+
Immobilis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/10/2007, 12h29   #3
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 48
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 48
Points : 11
Points : 11
Bonjour
J'ai encore
la meme erreur

Code :
Erreur de syntaxe (virgule) dans l'expression 'j=11, 26 and m=10, 1 and a=2007, 2005 and element='a104' and annule=false'.
Après avoir enlever la 2e connexion...Voici mon code

Code :
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
<%
 
 
 
dsn ="DBQ="&Server.Mappath("./db/resa.mdb")&";Driver={Microsoft Access Driver(*.mdb)};"
 
 
 
 
dsn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("./db/xxxxxxxxxxxxxxxxxx.mdb")&";"
 
 
' VERIFIE SI L'ÉLÉMENT À DÉJA ÉTÉ RÉSERVÉ
 
response.buffer = true
'declaration
dim useraction
dim conn,dsn,rs,sql
'if the user submit the form
 
useraction = request("action")
 
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open dsn
SQL = "SELECT *  FROM reservation WHERE j=" & j & "  and m=" & m & " and a=" &  a & " and element='" & elements & "' and annule=false order by element ASC"
rs.open sql,conn
 
	if Not RS.EOF then
	isP1 = false
	isP2 = false
	isMidi = false
	isP3 = false
	isP4 = false
	isSoir = false
	Do While Not RS.EOF
		if RS("periode1") then
			isP1=true
		end if
		if RS("periode2") then
			isP2=true
		end if
		if RS("midi") then
			isMidi=true
		end if
		if RS("periode3") then
			isP3=true
		end if
		if RS("periode4") then
			isP4=true
		end if
		if RS("soiree") then
			isSoir=true
		end if
		RS.MoveNext
	loop
	end if
	isResValide = true
	if isP1 and peri1 = "on" then
		isResValide = false
	end if
	if isP2 and peri2 = "on" then
		isResValide = false
	end if
	if isMidi and midi = "on" then
		isResValide = false
	end if
	if isP3 and peri3 = "on" then
		isResValide = false
	end if
	if isP4 and peri4 = "on" then
		isResValide = false
	end if
	if isSoir and soir = "on" then
		isResValide = false
	end if
'if rs.eof and rs.bof then
if isResValide then
	Randomize()
	intRangeSize = 9999999 - 1000000 + 1
	sngRandomValue = intRangeSize * Rnd()
	sngRandomValue = sngRandomValue + intLowerBound
	cle = Int(sngRandomValue)
	Session("SID") = cle
%>
Et cellui...selon moi...qui cause le problème

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<%
 
 
...
 
if instr(j,",")>0 then
 
 
j= Split(j,",", -1, 1)
m= Split(m,",", -1, 1)
a= Split(a,",", -1, 1)
 
 
For i = 0 to Ubound(i) step 1
 
%>
Merci
tidus666x est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/10/2007, 14h10   #4
Modérateur
 
Avatar de roro06
 
Inscription : avril 2007
Messages : 1 364
Détails du profil
Informations personnelles :
Âge : 42

Informations forums :
Inscription : avril 2007
Messages : 1 364
Points : 1 551
Points : 1 551
Bonjour

Oui

Citation:
j=11, 26 and m=10, 1 and a=2007, 2005 and element='a104' and ...
n'est pas valide en SQL

au besoin, tu peux mettre : (pareil pour les autres champs, of course)
roro06 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/10/2007, 14h33   #5
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 48
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 48
Points : 11
Points : 11
Ayoye merci !

Mais maintenant j'ai cette petite erreur

Code :
1
2
3
4
5
Erreur d'exécution Microsoft VBScript erreur '800a000d' 
 
Type incompatible: 'Ubound' 
 
/chenebleu/informatique/images/cardinal112/reservelocal/ok.asp, ligne 323
Voici le code:

Code :
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
if instr(j,",")=0 and j<>"" then
 
%>
 
 <% =j%>/<% =m%>/<% =a%> 
 
 
<%
end if
 
 
if instr(j,",")>0 then
 
j= Split(j,",", -1, 1)
m= Split(m,",", -1, 1)
a= Split(a,",", -1, 1)
 
 
For i = 0 to Ubound(j) step 1
 
%>
 
 
 <% =j%>/<% =m%>/<% =a%> 
 
 
 
<%
 
next
end if
%>
Merci
tidus666x est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/10/2007, 15h35   #6
Modérateur
 
Avatar de roro06
 
Inscription : avril 2007
Messages : 1 364
Détails du profil
Informations personnelles :
Âge : 42

Informations forums :
Inscription : avril 2007
Messages : 1 364
Points : 1 551
Points : 1 551
Citation:
if instr(j,",")>0 then

j= Split(j,",", -1, 1)
Utilises peut-etre une deuxieme variable
Code :
1
2
3
if instr(j,",")>0 then
 
j2= Split(j,",", -1, 1)
roro06 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/10/2007, 19h31   #7
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 850
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 850
Points : 5 966
Points : 5 966
Je vaut "j"?
Citation:
j= Split(j,",", -1, 1)
EtTout simplement?
Immobilis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/10/2007, 22h39   #8
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 48
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 48
Points : 11
Points : 11
Bonjour !

Aujourd'hui j'ai réussie à règler le problème de cette manière:

Code :
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
<%



	
if instr(j,",")=0 and j<>"" then

%>

 <% =j%>/<% =m%>/<% =a%> 


<%
end if


if instr(j,",")>0 then





j= Split(j,",", -1, 1)
m= Split(m,",", -1, 1)
a= Split(a,",", -1, 1)


For i = 0 to Ubound(j) step 1

%>


 <% =j(i)%>/<% =m(i)%>/<% =a(i)%> <br>



<%

next
end if



%>
Et pour ma requete:

Code :
1
2
SQL = "SELECT *  FROM reservation WHERE j in (j) and m in (m) and a in (a) and element='" & elements & "' and annule=false order by element ASC"
Merci énormément pour votre aide
tidus666x est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 15h20.


 
 
 
 
Partenaires

Hébergement Web