F
fyhxf
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TuserForm.fBitBtnClick(Sender: TObject);
var
strsql:string;
begin
strsql:='BEGGIN TRAN sp_addlogin '''+edit1.text+''','''+edit2.text+''','''+combobox1.text+''',,@encryptopt='''+combobox4.Text+'''';
strsql:=strsql+' sp_addsrvrolemember '''+ edit3.Text+''','''+combobox5.Text+'''';
strsql:=strsql+'sp_grantdbaccess '''+edit4.Text+''','''+edit5.Text+'''';
strsql:=strsql+' sp_addrolemember '''+combobox6.Text+''','''+edit6.Text+''' COMMIT TRAN';
//strsql:='sp_addlogin '''+edit1.text+''','''+edit2.text+''','''+combobox1.text+''',@encryptopt='''+combobox4.text+'''';
if ((edit1.text=edit3.text) and (edit3.text=Edit4.text)) then
begin
DataModule1.ADOQuery2.Close;
DataModule1.ADOQuery2.SQL.Clear;
DataModule1.ADOQuery2.SQL.Add(strsql);
DataModule1.ADOQuery2.ExecSQL;
end
else
showmessage('请正确输入登录帐号');
end;
procedure TuserForm.FormShow(Sender: TObject);
begin
pagecontrol1.Pages[0].Show;
ubitbtn.Enabled :=false;
fbitbtn.Enabled :=false;
try
DataModule1.adoquery1.Close ;
DataModule1.adoquery1.SQL.Clear;
DataModule1.adoquery1.SQL.Add('select name from sysdatabases');
DataModule1.adoquery1.Open;
ComboBox1.Clear;
ComboBox1.Items.Add('所有的数据库');
while not DataModule1.ADOQuery1.Eof do
begin
ComboBox1.Items.Add(trim(DataModule1.adoquery1.FieldValues['name']));
DataModule1.adoquery1.Next;
end;
ComboBox1.ItemIndex:=0;
finally
DataModule1.adoquery1.Close;
end;
try
DataModule1.adoquery1.Close ;
DataModule1.adoquery1.SQL.Clear;
DataModule1.adoquery1.SQL.Add('select name from syslanguages');
DataModule1.adoquery1.Open;
ComboBox2.Clear;
ComboBox2.Items.Add('所有的语言');
while not DataModule1.ADOQuery1.Eof do
begin
ComboBox2.Items.Add(trim(DataModule1.adoquery1.FieldValues['name']));
DataModule1.adoquery1.Next;
end;
ComboBox2.ItemIndex:=0;
finally
DataModule1.adoquery1.Close;
end;
try
DataModule1.adoquery1.Close ;
DataModule1.adoquery1.SQL.Clear;
DataModule1.adoquery1.SQL.Add('select name from sysusers');
DataModule1.adoquery1.Open;
ComboBox6.Clear;
ComboBox6.Items.Add('所有的数据库角色');
while not DataModule1.ADOQuery1.Eof do
begin
ComboBox6.Items.Add(trim(DataModule1.adoquery1.FieldValues['name']));
DataModule1.adoquery1.Next;
end;
ComboBox6.ItemIndex:=0;
finally
DataModule1.adoquery1.Close;
end;
end;
procedure TupuserForm.Button3Click(Sender: TObject);
begin
if combobox1.text='服务器用户' then
begin
DataModule1.ADOQuery2.Close;
DataModule1.ADOQuery2.SQL.Clear;
DataModule1.ADOQuery2.SQL.Add('sp_droplogin '''+combobox4.text+'''');
DataModule1.ADOQuery2.Open;
DataModule1.ADOQuery2.ExecSQL;
end
else if combobox1.text='数据库用户' then
begin
DataModule1.ADOQuery2.Close;
DataModule1.ADOQuery2.SQL.Clear;
DataModule1.ADOQuery2.SQL.Add('sp_revokedbaccess '''+combobox4.text+'''');
DataModule1.ADOQuery2.Open;
DataModule1.ADOQuery2.ExecSQL;
end
else if combobox1.text='服务器角色' then
begin
DataModule1.ADOQuery2.Close;
DataModule1.ADOQuery2.SQL.Clear;
DataModule1.ADOQuery2.SQL.Add('sp_dropsrvrrolemember '''+combobox4.text+'''');
DataModule1.ADOQuery2.Open;
DataModule1.ADOQuery2.ExecSQL;
end
else
begin
DataModule1.adoquery1.Close ;
DataModule1.adoquery1.SQL.Clear;
DataModule1.adoquery1.SQL.Add('sp_droprole '''+combobox4.text+'''');
DataModule1.adoquery1.Open;
DataModule1.ADOQuery2.ExecSQL;
end;
end;
好象是参数不怎么对,请帮帮我吧
var
strsql:string;
begin
strsql:='BEGGIN TRAN sp_addlogin '''+edit1.text+''','''+edit2.text+''','''+combobox1.text+''',,@encryptopt='''+combobox4.Text+'''';
strsql:=strsql+' sp_addsrvrolemember '''+ edit3.Text+''','''+combobox5.Text+'''';
strsql:=strsql+'sp_grantdbaccess '''+edit4.Text+''','''+edit5.Text+'''';
strsql:=strsql+' sp_addrolemember '''+combobox6.Text+''','''+edit6.Text+''' COMMIT TRAN';
//strsql:='sp_addlogin '''+edit1.text+''','''+edit2.text+''','''+combobox1.text+''',@encryptopt='''+combobox4.text+'''';
if ((edit1.text=edit3.text) and (edit3.text=Edit4.text)) then
begin
DataModule1.ADOQuery2.Close;
DataModule1.ADOQuery2.SQL.Clear;
DataModule1.ADOQuery2.SQL.Add(strsql);
DataModule1.ADOQuery2.ExecSQL;
end
else
showmessage('请正确输入登录帐号');
end;
procedure TuserForm.FormShow(Sender: TObject);
begin
pagecontrol1.Pages[0].Show;
ubitbtn.Enabled :=false;
fbitbtn.Enabled :=false;
try
DataModule1.adoquery1.Close ;
DataModule1.adoquery1.SQL.Clear;
DataModule1.adoquery1.SQL.Add('select name from sysdatabases');
DataModule1.adoquery1.Open;
ComboBox1.Clear;
ComboBox1.Items.Add('所有的数据库');
while not DataModule1.ADOQuery1.Eof do
begin
ComboBox1.Items.Add(trim(DataModule1.adoquery1.FieldValues['name']));
DataModule1.adoquery1.Next;
end;
ComboBox1.ItemIndex:=0;
finally
DataModule1.adoquery1.Close;
end;
try
DataModule1.adoquery1.Close ;
DataModule1.adoquery1.SQL.Clear;
DataModule1.adoquery1.SQL.Add('select name from syslanguages');
DataModule1.adoquery1.Open;
ComboBox2.Clear;
ComboBox2.Items.Add('所有的语言');
while not DataModule1.ADOQuery1.Eof do
begin
ComboBox2.Items.Add(trim(DataModule1.adoquery1.FieldValues['name']));
DataModule1.adoquery1.Next;
end;
ComboBox2.ItemIndex:=0;
finally
DataModule1.adoquery1.Close;
end;
try
DataModule1.adoquery1.Close ;
DataModule1.adoquery1.SQL.Clear;
DataModule1.adoquery1.SQL.Add('select name from sysusers');
DataModule1.adoquery1.Open;
ComboBox6.Clear;
ComboBox6.Items.Add('所有的数据库角色');
while not DataModule1.ADOQuery1.Eof do
begin
ComboBox6.Items.Add(trim(DataModule1.adoquery1.FieldValues['name']));
DataModule1.adoquery1.Next;
end;
ComboBox6.ItemIndex:=0;
finally
DataModule1.adoquery1.Close;
end;
end;
procedure TupuserForm.Button3Click(Sender: TObject);
begin
if combobox1.text='服务器用户' then
begin
DataModule1.ADOQuery2.Close;
DataModule1.ADOQuery2.SQL.Clear;
DataModule1.ADOQuery2.SQL.Add('sp_droplogin '''+combobox4.text+'''');
DataModule1.ADOQuery2.Open;
DataModule1.ADOQuery2.ExecSQL;
end
else if combobox1.text='数据库用户' then
begin
DataModule1.ADOQuery2.Close;
DataModule1.ADOQuery2.SQL.Clear;
DataModule1.ADOQuery2.SQL.Add('sp_revokedbaccess '''+combobox4.text+'''');
DataModule1.ADOQuery2.Open;
DataModule1.ADOQuery2.ExecSQL;
end
else if combobox1.text='服务器角色' then
begin
DataModule1.ADOQuery2.Close;
DataModule1.ADOQuery2.SQL.Clear;
DataModule1.ADOQuery2.SQL.Add('sp_dropsrvrrolemember '''+combobox4.text+'''');
DataModule1.ADOQuery2.Open;
DataModule1.ADOQuery2.ExecSQL;
end
else
begin
DataModule1.adoquery1.Close ;
DataModule1.adoquery1.SQL.Clear;
DataModule1.adoquery1.SQL.Add('sp_droprole '''+combobox4.text+'''');
DataModule1.adoquery1.Open;
DataModule1.ADOQuery2.ExecSQL;
end;
end;
好象是参数不怎么对,请帮帮我吧