you should be able to access SQLDMO.ApplicationClass's IntegratedSecurity object, try to set its SecurityMode propertythe following example is in VBScript, but the idea should be same http://groups-beta.google.com/group/microsoft.public.sqlserver.setup/msg/26f6ea6371637f7dalso see http://msdn.microsoft.com/library/en-us/sqldmo/dmoref_p_s_3vqx.asp?frame=true
兄弟我怎么找不到SecurityMode 这个属性啊!
SQLDMO.SQLServer svr = new SQLDMO.SQLServerClass() ; if (this.RB_Auth_SQL.Checked) { svr.Connect(ServerName,UserName,Password); } if (this.RB_Auth_Windows.Checked) { svr.LoginSecure = true; svr.LoginTimeout = 15; svr.Connect(ServerName,null,null); }
svr.LoginSecure = true 这个参数即是: 当为true时为windows登陆模式,需要windows的用户名,密码;当为false时为sql server登陆模式 输入sql server 服务器的用户名,密码
http://groups-beta.google.com/group/microsoft.public.sqlserver.setup/msg/26f6ea6371637f7dalso see
http://msdn.microsoft.com/library/en-us/sqldmo/dmoref_p_s_3vqx.asp?frame=true
if (this.RB_Auth_SQL.Checked)
{
svr.Connect(ServerName,UserName,Password);
}
if (this.RB_Auth_Windows.Checked)
{
svr.LoginSecure = true;
svr.LoginTimeout = 15;
svr.Connect(ServerName,null,null);
}
这个参数即是:
当为true时为windows登陆模式,需要windows的用户名,密码;当为false时为sql server登陆模式
输入sql server 服务器的用户名,密码