各位前辈请赐教:首先我想把一个报警标志值(integer)写到数据库某个表中,这个怎么写啊?然后我想通过应用程序在时刻读取数据库中的信息,如报警标志改变则各个联到这个数据库的应用程序均发出报警,那么再怎么实现应用程序时刻读取数据库表中的信息啊?先谢谢大家了.

解决方案 »

  1.   

    不好意思,我再补充一些吧:我是想说:首先我想把一个报警标志改变值(integer)写到数据库某个表的相应字段中,这个怎么写啊?然后我想通过应用程序时刻读取数据库中的信息,如报警标志改变(当符合报警条件)则各个联到这个数据库的应用程序均发出报警,那么再怎么实现应用程序时刻读取数据库表中的信息啊?
      

  2.   

    写入
    update table1 set jb=1 where....
    读出的时候应用程序有一个timer,每个一段时间,读出来
    select jb from table1 where...
    然后你会得到的结果,然后比较就可以了
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      with adoquery1 do
      begin
        close;
        sql.Add('update table1 set jb=1 where xm=:a')
        Parameters[0].Value:=edit1.text;
        execsql;
      end;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      with adoquery1 do
      begin
        close;
        sql.Clear;
        sql.Add('select jb from table1 where xm=:a');
        Parameters[0].Value:=edit1.text;
        open;
      end;
      if adoquery1.Recordset.Fields[0].Value=1 then
        dosmth
    end;
      

  4.   

    可以通过SOCKET发送消息的形式来实现
      

  5.   

    楼主问的有三个问题:
    1.如何进行数据库的读写,这个如下即可:
    AdoQuery1.Close;
    AdoQuery1.SQL.Text := 
      'update tablename set field1=' + Edit1.Text + ' where field1=0';
    AdoQuery1.ExecSql;2.实时读取数据库中某一个字段的值
    这个可以用Timer来实现3.当达到要求时发送消息
    这个可以用Socket来实现
    基本思路:在你的应用程序启动时,打开一个端口
    然后当条件成熟,即通过这个端口发送你的消息即可
      

  6.   

    我想再问一下:
    当我执行sql.Add('update table1 set jb=1 where xm=:a')或AdoQuery1.SQL.Text := 
      'update tablename set field1=' + Edit1.Text + ' where field1=0';系统提示同样的错误([Error] unit_open.pas(197): Missing operator or semicolon)这是怎么事情啊?