if ServerName=' then begin Mymessagebox('请输入正确的服务器名!',mb_ok); ServerEdit.setfocus; end else if UserName=' then begin Mymessagebox('请输入正确的登录用户ID!',mb_ok); UserEdit.setfocus; end else with Datafrm do if ConnectByParam(ServerName,DbName,DbType,UserName,Password) then begin Mymessagebox('成功登录到数据库服务器:'+ServerName+'!',mb_ok); RegisterKeyStr(HKEY_LOCAL_MACHINE,'\SOFTWARE\MONEYCS\MainDb','Server Name',ServerName,1); RegisterKeyStr(HKEY_LOCAL_MACHINE,'\SOFTWARE\MONEYCS\MainDb','DataBase Name',DBName,1); RegisterKeyStr(HKEY_LOCAL_MACHINE,'\SOFTWARE\MONEYCS\MainDb','DataBase Type',DBType,1); RegisterKeyStr(HKEY_LOCAL_MACHINE,'\SOFTWARE\MONEYCS\MainDb','User Name',UserName,1); EncryptObj:=TSimpleEncrypt.Create; EnPassword:=EncryptObj.Encrypt(Password); RegisterKeyStr(HKEY_LOCAL_MACHINE,'\SOFTWARE\MONEYCS\MainDb','Password',EnPassword,1);
RegisterServerFrm.modalresult :=mrok; end; |