为什么我不能动态连接数据库啊?下面是代码,为什么会说是"无效的授权说明"
我手动设置adoconnection 却能连上,数据库应该没问题啊?????重装了个系统怎么就会出这种问题呢??????
adoconnection1.Connected:=false;
str:='';
str:='provider=SQLOLEDB.1;'+'Integrated security=SSPI;'+'persist Secutity Info=false;';
str:=str+'User ID='+edit2.Text+';'; //sa登陆
str:=str+'password='+edit3.Text+';'; //为空
str:=str+'Initial Catalog='+edit4.Text+';'; //master
str:=str+'Data Source='+edit1.Text+';'; //服务器名称
try
adoconnection1.Connected:=true;
showmessage('连接到目的服务器!');
except
showmessage('连接错误');
end;
我手动设置adoconnection 却能连上,数据库应该没问题啊?????重装了个系统怎么就会出这种问题呢??????
adoconnection1.Connected:=false;
str:='';
str:='provider=SQLOLEDB.1;'+'Integrated security=SSPI;'+'persist Secutity Info=false;';
str:=str+'User ID='+edit2.Text+';'; //sa登陆
str:=str+'password='+edit3.Text+';'; //为空
str:=str+'Initial Catalog='+edit4.Text+';'; //master
str:=str+'Data Source='+edit1.Text+';'; //服务器名称
try
adoconnection1.Connected:=true;
showmessage('连接到目的服务器!');
except
showmessage('连接错误');
end;
str:='';
str:='provider=SQLOLEDB.1;'+'Integrated security=SSPI;'+'persist Secutity Info=false;';
str:=str+'User ID='+edit2.Text+';'; //sa登陆
str:=str+'password='+edit3.Text+';'; //为空
str:=str+'Initial Catalog='+edit4.Text+';'; //master
str:=str+'Data Source='+edit1.Text+';'; //服务器名称
try
adoconnection1.connectstring:=str;//你忘了这句
adoconnection1.Connected:=true;
showmessage('连接到目的服务器!');
except
showmessage('连接错误');
end;