1)在调用
 var look:string;
 look:=inputbox('系统提示','请输入要查询班级的代号!',''); 
 后,希望此值在
application.MessageBox('查无此班级'+look+'代号,系统允许添加[代号不能为空]!','系统认证通过',mb_ok)   各位:明白我的意思吗?也就是说在后者引用look,我这样不行,编译出现错误: [Error] Unit3.pas(87): Incompatible types: 'String' and 'PAnsiChar'
怎样改正?
 2:)我利用DBgrid,datasource和adoquery查询时:(一个按扭用于查询,一个用于删除)问题就是说怎样删除当前记录指针指向的数据行。即想在按扭单击事件中通过再更改ADOquery的SQL属性来删除。也就是说删除的条件
语句怎样写?
我的大意也就是:delete from 表名  where kk=dbgrid中当前行第一列的值我就是不会描述这个条件属性,指教

解决方案 »

  1.   

    var
    str:='查无此班级'+look+'代号,系统允许添加[代号不能为空]!';
    application.MessageBox(pchar(str)','系统认证通过',mb_ok)
      

  2.   

    可以用adoquery.delete 直接删除
      

  3.   

    Try
     sSql:= '查无此班级'+look+'代号,系统允许添加[代号不能为空]!';
     MessageDlg(sSql,mtConfirmation, [mbYes, mbNo], 0) ;
      

  4.   

    Try
    var
      sSql:String;
    begin
      adoquery.close;
      adoquery.sql.clear;
      sSql:='delete from'+ 表名  +'where kk='+dbgrid中当前行第一列的值;
      adoquery.sql.add ('sSql');
      adoquery.execute;
    end; 
      

  5.   

    第一个问题:program Project1;uses
      Forms,Dialogs,
      Unit1 in 'Unit1.pas' {Form1};{$R *.RES}
    var
    look:string;
    aa:string;
    begin
      Application.Initialize;
      Application.CreateForm(TForm1, Form1);
      look:=inputbox('系统提示','请输入要查询班级的代号!','');
      aa:='查无此班级'+look+'代号,系统允许添加[代号不能为空]!';
      application.MessageBox(pchar(aa),pchar('系统认证通过'),1);
      Application.Run;
    end.Value Numeric value MeaningIDOK 1 The user chose the OK button.
    IDCANCEL 2 The user chose the Cancel button.
    IDABORT 3 The user chose the Abort button.
    IDRETRY 4 The user chose the Retry button.
    IDIGNORE 5 The user chose the Ignore button.
    IDYES 6 The user chose the Yes button.
    IDNO 7 The user chose the No button.
      

  6.   

    问题我也就是不会描述:怎样取dbgrid当前行第一例的值
    当前行当然是可以随时变动的。
      

  7.   

    1、大家已经回答你了,做一个转换就可以了
    2、
    delete from 表名  where kk=dbgrid,datasource.dataset.fieldvlaues['kk']