線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1029
推到 Plurk!
推到 Facebook!

Create Paradox的db檔,如何加密碼

尚未結案
vivi_11202001
一般會員


發表:1
回覆:1
積分:0
註冊:2003-09-26

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-04-02 16:52:57 IP:203.69.xxx.xxx 未訂閱
請問我用SQL語法,create一個Paradox的db檔,但是不會用SQL語法設定密碼. 我不要用database desktop設定密碼,有設定密碼的SQL語法嗎? 或者可以在DELPHI寫程式碼,讓這個DB檔產生一個指定的密碼?
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-04-02 17:37:15 IP:202.39.xxx.xxx 未訂閱
http://groups.google.com.tw/groups?hl=zh-TW&lr=&ie=UTF-8&oe=UTF-8&th=db197bfe7c6ebf48&rnum=9    
//----------------------------------------------------------------------//
// This functions are copied from Borland Developer support www page    //
//----------------------------------------------------------------------//    function GetSecNoFromName(hDb: hDBIDb; TblName, pswd: string): word;
forward;    procedure AddMasterPassword(Table: TTable; pswd: string);
const
  RESTRUCTURE_TRUE = WordBool(1);    var
  TblDesc: CRTblDesc;
  hDb: hDBIDb;    begin
  { Make sure that the table is opened and is exclusive }
  if (Table.Active = False) or (Table.Exclusive = False) then
    raise EDatabaseError.Create('Table must be opened in exclusive mode to
add passwords');
  { Initialize the table descriptor }
  FillChar(TblDesc, SizeOf(CRTblDesc), 0);      with TblDesc do
  begin
    { Place the table name in descriptor }
    StrPCopy(szTblName, Table.TableName);
    { Place the table type in descriptor }
    StrCopy(szTblType, szPARADOX);
    { Master Password, Password }
    StrPCopy(szPassword, pswd);
    { Set bProtected to True }
    bProtected := RESTRUCTURE_TRUE;
  end;      { Get the database handle from the cursor handle }
  Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE,
hDBIObj(hDb)));
  { Close the table }
  Table.Close;
  { Add the master password to the Paradox table }
  Check(DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, FALSE));
  { Add the new password to the session }
  Session.AddPassword(pswd);
  { Re-Open the table }
  Table.Open;
end;    procedure RemoveMasterPassword(Table: TTable);
const
  RESTRUCTURE_FALSE = WordBool(0);    var
  TblDesc: CRTblDesc;
  hDb: hDBIDb;    begin
  { Make sure that the table is opened and is exclusive }
  if (Table.Active = False) or (Table.Exclusive = False) then
    raise EDatabaseError.Create('Table must be opened in exclusive mode to
remove passwords');
  { Initialize the table descriptor }
  FillChar(TblDesc, SizeOf(CRTblDesc), 0);      with TblDesc do
  begin
    { Place the table name in descriptor }
    StrPCopy(szTblName, Table.TableName);
    { Place the table type in descriptor }
    StrCopy(szTblType, szPARADOX);
    { Set bProtected to False }
    bProtected := RESTRUCTURE_FALSE;
  end;      { Get the database handle from the cursor handle }
  Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE,
hDBIObj(hDb)));
  { Close the table }
  Table.Close;
  { Add the master password to the Paradox table }
  Check(DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, FALSE));
  { Re-Open the table }
  Table.Open;
end;    
-- He just never quits. 發表人 - hagar 於 2004/04/02 17:37:56
vivi_11202001
一般會員


發表:1
回覆:1
積分:0
註冊:2003-09-26

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-04-06 08:19:07 IP:203.69.xxx.xxx 未訂閱
謝謝.. 我昨天測了..還蠻好用的^^
系統時間:2024-05-17 11:54:44
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!