procedure TForm1.SQLConnectionBeforeConnect(Sender: TObject);
begin
with Sender as TSQLConnection do
begin
if LoginPrompt = False then
{判别TSQLConnection组件的LoginPrompt属性,如果为False,则设置用户名和口令}
begin
Params.Values['User_Name'] := 'ORA';
Params.Values['Password'] := PasswordEdit.txt;
//口令使用编辑框PasswordEdit中用户动态输入的内容
end;
end;
end;
确定用户登录数据库的合法性
本文介绍了一种在Delphi中配置TSQLConnection组件的方法,通过动态设置登录用户名和密码实现数据库的安全连接。当LoginPrompt属性设为False时,程序会自动填充用户名和密码字段。

被折叠的 条评论
为什么被折叠?



