connexion à une base MSSQL
Bonjour,
J'ai un soucis avec la requete suivante :
Code:
1 2 3 4
| with c as ( select [ID], [Type], ROW_NUMBER() over (order by ID) as curRow
FROM dbo.Rapport as S INNER JOIN (SELECT IdRapport as I, max(Version) AS Ver, min(DRAFT) AS Dr FROM dbo.Rapport GROUP BY idRapport) AS V ON S.idRapport = V.I AND S.Version = V.Ver AND S.DRAFT = V.Dr
WHERE (RedNomPrenom = 'truc' OR VerNomPrenom = 'truc' OR AppNomPrenom = 'truc') )
SELECT * FROM c WHERE curRow > 0 AND curRow < 10 |
et le code php suivant pour l'executer :
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
| $this->numrows=0;
$this->numcols=0;
$this->query = $query;
$cursor = odbc_prepare ($this->connex, $query);
odbc_execute($cursor);
$i = $startindex;
$this->table=array();
$this->numcols = odbc_num_fields($cursor);
while (odbc_fetch_row($cursor))
{
$j = 0;
while ($j < $this->numcols)
{
$str = odbc_result($cursor, 2);
$this->table[$i][$j] = $str;
$j++;
}
$i++;
}
$this->numrows = $i;
odbc_free_result ($cursor); |
Quand j'execute celle-ci avec le code, j'ai le message d'erreur suivant :
Citation:
Warning: odbc_result(): SQL error: [Microsoft][bibliothèque de curseurs ODBC] Le résultat n'a pas été généré par une instruction SELECT, SQL state SL004 in SQLGetData in D:\WW....
Et je ne sais pas comment la résoudre.
Pourriez vous m'aider ?
Merci.