如何在sql中使用变量作为字段名?

bihw5rsg  于 2021-08-13  发布在  Java
关注(0)|答案(0)|浏览(238)
procedure TfrmMainMenu.btnSearchClick(Sender: TObject);
var
  sFieldName,sSearchInfo:string;
begin
  sFieldName:=  cmbFieldNames.Text;

 if sFieldName='Field Names' then
 begin
   ShowMessage('Please Select A Vaild Field!!:(');
 end
 else
 begin
   sSearchInfo:=InputBox('Search for'+' '+ sFieldName,'Enter the '+' '+sFieldName,'') ;

    RunSql('SELECT *  FROM PackageTB  WHERE"'+sFieldName+'"="'+sSearchInfo+'" ') ;//Procedure to run Sql

 end; //Gets Data to Search from

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题