字段是否存在


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. void __fastcall TForm1::Button1Click(TObject *Sender)
  2. {
  3. int i;
  4.  
  5. for (i = 0; i < Table1->FieldCount; i++)
  6. {
  7. if (!strcmp(Edit1->Text.c_str(), Table1->Fields->Fields[i]->FieldName.c_str()))
  8. {
  9. Edit2->Text = "ok" + Table1->Fields->Fields[i]->FieldName;
  10. break;
  11. }
  12. }
  13.  
  14. if (i == Table1->FieldCount)
  15. {
  16. Edit2->Text = "no";
  17. }
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.