problème d'exécution d'un requête SQL!
je reçois une chaîne de charactères et je construis un requête comme ça:
Code:
1 2 3 4 5 6 7 8 9 10
|
AnsiString str;
int n;
str = Edit1->Text;
ADOCommand1->CommandText = "";
ADOCommand1->CommandText = "select * from CDS_Card_Data where ICCID = '";
ADOCommand1->CommandText += str;
ADOCommand1->CommandText += "'";
Edit2->Text = ADOCommand1->CommandText;
ADODataSet1->Recordset = ADOCommand1->Execute(); |
Mais le COMPILER m'alerte toujous:
Code:
1 2 3
| Project TestProject.exe raised exception class EOleException with message '[MicroSoft][ODBC MicroSoft
Access Driver]Syntax error in string in query expression 'ICCID ='" Process Stopped. Use Step or Run to
continue. |
Pourquoi est-ce qu'il a causé cette erreur?
Si je rédige un requête fixe dans la propriété CommandText sur la fenêtre "Object Inspector" comme ça:
select * from CDS_Card_Data where ICCID = '89840321080002701056'
par exemple, il marchera bien!!! c'est bizarre!
Merci tous d'avance!