客户端通过ADO连接服务器,查询、写入、更新一切正常,拔掉网线报连接失败,再插上网线还是连接失败,关闭应用程序,重新启动应用程序,一切又正常,怎么回事啊?我记得以前不会这样啊?怎么办有没有什么解决方法?
谢谢了,150分奉上

解决方案 »

  1.   

    如果dm中含adoconnection:添加:
      if dm.ado_net.connected=false then dm.ado_net.connected:=true;
      

  2.   

    我以前试过。
    不知道你的代码如何写的。例如:
    procedure find_customer(customer_no:string;customer_filedname:string;):string;
    begin
        try
            temp_adoquery:=tadoquery.create(application.owner);
            if dm.ado_net.connected=false then dm.ado_net.connected:=true;
            temp_adoquery.connection:=dm.ado_net;
            temp_adoquery.sql.clear;
            temp_adoquery.sql.add('select * from table_customer');
            .....  
        finally
            temp_adoquery.free;
        end;
    end;
      

  3.   

    打字打错了。
    procedure改为function
      

  4.   

    大哥是可以,可是为什么每次ADOCONNECTION.connected:=true的时候都要提示输入密码呢?
    我在ADOCONNECTION。CONNECTIONSTRING里面已设置为允许保存密码啊?
    以前也碰到过这种问题,后来自己又好了,这是为什么呢?
      

  5.   

    再详细点:1。adoconnection置于datamodul中。
       如
       object ado_net:tadoconnction
              connected:=false
              connectionstring:=''
              loginprompt=false
    2.程序运行以后从注册表或本地的数据库中读出connectionstring到全局变量中。
    3.数据的查询、更新等等function置于一个unit中。(方便修改)
    4.在temp_adoquery.connection:=***前面加入:
         if dm.ado_net.connected=false then dm.ado_net.connected:=true;可以了。
      

  6.   

    loginprompt=false
    注册提示设为false.
    就可以不出现---提示输入密码