DataModule里有个ADOConnection连接sqlserver ,
在form_main里
DM.ADOConnection1.Close;
DM.ADOConnection1.Connected:=false;
DM.ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Password=test;Persist Security Info=True;User ID=test;Initial Catalog=fbc;Data Source=172.18.1.29';
DM.ADOConnection1.Connected:=true;
DM.ADOConnection1.open;怎么报错
‘Access violation at address ...............read od address 00000060’

解决方案 »

  1.   

    conn.ConnectionString :='Provider=MSDASQL.1;Extended Properties="DRIVER=SQL Server;SERVER=IP;UID=用户;PWD=密码;Network=DBMSSOCN;Address=IP,1433"';
      

  2.   

    DM.ADOConnection1.Connected:=false;
    DM.ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Password=test;Persist Security Info=True;User ID=test;Initial Catalog=fbc;Data Source=172.18.1.29';
    DM.ADOConnection1.Connected:=true;
      

  3.   

    好象DM.ADOConnection1.open;是多余的呀。
      

  4.   

    执行如下程序并填入一个错误的数据库ip,为什么要等待大约45秒才能timeout,在哪里设置timeout时间啊?try      DM.ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Password=test;Persist Security Info=True;User ID=test;Initial Catalog=table1;Data Source=172.18.1.22';
          DM.ADOConnection1.ConnectionTimeout:=3;
          
          DM.ADOConnection1.Connected:=true;
       except
            showmessage('connection time out');
    end;