Enterprise Managemer内,打开将服务器的属性对话框,在Security选项卡中,有一个选项Authentication。
如果该选项是Windows NT only,则你的程序所用的连接字符串就一定要包含Trusted_Connection参数,并且其值必须为yes,如:
"Provider=SQLOLEDB;Server=888;Trusted_Connection=yes"
";Database=master;uid=lad;";
如果不按上述操作,程序运行时连接必然失败。
如果Authentication选项是SQL Server and Windows NT,则你的程序所用的连接字符串可以不包含Trusted_Connection参数,如:
"Provider=SQLOLEDB;Server=888;Database=master;uid=lad;pwd=111;";
因为ADO给该参数取的默认值就是no,所以可以省略。我认为还是取默认值比较安全一些。