Exécuter une requette mysql via boucle for

peoplehard Messages postés 26 Date d'inscription samedi 26 avril 2003 Statut Membre Dernière intervention 26 novembre 2008 - 2 nov. 2008 à 11:26
peoplehard Messages postés 26 Date d'inscription samedi 26 avril 2003 Statut Membre Dernière intervention 26 novembre 2008 - 2 nov. 2008 à 18:01
Bonjour
J'aimerai que le arrayjour(i) soit exécuté via la boucle for. Mais ça me retourne: Either
BOF or EOF is True, or the current record has been deleted; the
operation requested by the application requires a current record.
Pourtant si j'entre arrayjour(1), j'obtiens bien quelque chose...

***********************
for i = 1 to nb
.
.
objRS.Open "SELECT `img` FROM `meteo` WHERE `date`="& arrayjour(i) &" AND `localisation` = CONVERT( _utf8 'BEXX0014' USING latin1 ) COLLATE latin1_swedish_ci ORDER BY `meteo`.`date` ASC", objConn, 3,3
.
.
objRS.Close
Set objRS = Nothing
objConn.Close
next
***********************

Merci d'avance

2 réponses

peoplehard Messages postés 26 Date d'inscription samedi 26 avril 2003 Statut Membre Dernière intervention 26 novembre 2008
2 nov. 2008 à 17:21
Par contre le response.write("SELECT `img` FROM `meteo` WHERE `date`= "& arrayjour(i)
&" AND `localisation` = CONVERT( _utf8 'BEXX0014' USING latin1 )
COLLATE latin1_swedish_ci ORDER BY `meteo`.`date` ASC" est correctement interprété dans la boucle.

Peut être qu'il y a un truc spécial à faire pour qu'il soit interprété par le objRS.Open.

Merci d'avance pour votre aide.
0
peoplehard Messages postés 26 Date d'inscription samedi 26 avril 2003 Statut Membre Dernière intervention 26 novembre 2008
2 nov. 2008 à 18:01
Par contre si j'utilise:

***********************
For Each daymeteo In arrayjour
.
.
objRS.Open "SELECT `img` FROM `meteo` WHERE `date`= "& daymeteo
&" AND `localisation` = CONVERT( _utf8 'BEXX0014' USING latin1 )
COLLATE latin1_swedish_ci ORDER BY `meteo`.`date` ASC", objConn, 3,3
.
.
objRS.Close
Set objRS = Nothing
objConn.Close
next
***********************

J'obtiens l'erreur suivante:
ADODB.Recordset.1 (0x80004005)
SQLState:
37000
Native Error Code: 1064
[MySQL][ODBC 3.51 Driver][mysqld-one.com mysql proxy]You have an error
in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'AND `localisation` =
CONVERT( _utf8 'BEXX0014' USING latin1 ) COLLA...
0
Rejoignez-nous