MySQL problème de requète
Je sèche depuis cet après-midi :-/
Je cherche à afficher les données d'une table dans un DBGrid.
En fonction du code, j'obtiens soit toute la table, soit une grille vide :calim2:
Voici mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
procedure TForm1.SelLotChange(Sender: TObject);
begin
// filtrer l'affichage de dbgrid
selLot.Text:=selLot.selText;
SQLConnection_QCVal.connected:=False;
DBAdvgrid_QCVal.ClearAll;
DBAdvgrid_QCVal.UpdateActive;
SQLConnection_QCVal.connected:=False;
SQLDataset_QCVal.CommandText:='select * from qc_val where QCLot = '''+selLot.selText+''' ';
SQLConnection_QCVal.connected:=True;
ClientDataSet_QCVal.Active:=False;
ClientDataSet_QCVal.Active:=True;
DBAdvgrid_QCVal.Update;
selLot.selText:='';
end; |
avec la variante qui m'affiche tout:
Code:
SQLDataset_QCVal.CommandText:='select * from qc_val where QCLot = '''+'%'+selLot.selText+''' ';
et avec le code simpliste:
Code:
1 2 3 4 5 6 7 8
| procedure TForm1.SelLotChange(Sender: TObject);
begin
// filtrer l'affichage de dbgrid
ClientDataSet_QCVal.Active:=False;
SQLConnection_QCVal.connected:=False;
SQLDataset_QCVal.CommandText:='select * from qc_val where QCLot like ''33501103''';
SQLConnection_QCVal.connected:=True;
end; |
ne m'affiche rien :help:
Au plus j'avance, au moins j'y comprend qq chose :(
Merci pour vos suggestions :ccool: