我现有一程序在Delphi环境中使用没有问题, 可离开Delphi,再使用时就出现(Login fail user for 'sa'), 以前数据库挂在win2000中没有这个问题, 后来服务器升级到win2003之后就出现这样的问题了,我真是百思不得期解.代码为: ADOCommand1.ConnectionString :='Provider=SQLOLEDB.1;Password=000000;'+
       'Persist Security Info=True;User ID=sa;Initial Catalog=Test;'+
       'Data Source=DataBase';   
 ADOCommand1.CommandText:='insert into rec  select ''0'',''ID'',''''';
 try
   ADOCommand1.Execute;
 except
   Showmessage('Fail');
 end;就这么几句

解决方案 »

  1.   

    我想是因为你服务器升级后,装sql server 的时候,sa用户作了与原来2000系统不同的设置,
    如设置了不同的密码什么的。然后你的程序用sa 就无法访问升级后的数据库了。你可以打开程序,重新设置数据库连接,然后重新编译,再看看。
      

  2.   

    密码绝对没问题, 可问题是在Delphi环境中可用, 脱离之后就不可以了.后来我重建一项目,用同样的方式重写代码,编译以后就可以了. 真是把我搞晕了,幸好只有短短的几行代码.
      

  3.   

    你使用的是Windows验证,服务器升级以后,Server2003的验证方式可能不一样,或者它默认对你的这台客户机不再信任,
    我推荐使用SQL密码验证。
      

  4.   

    ADOCommand1.ConnectionString :='Provider=SQLOLEDB.1;Password=000000;'+
           'User ID=sa;Initial Catalog=Test;'+
           'Data Source=DataBase';   
     ADOCommand1.CommandText:='insert into rec  select ''0'',''ID'',''''';
     try
       ADOCommand1.Execute;
     except
       Showmessage('Fail');
     end;
     
    楼主试试吧!!