> 如何建立 UDL 檔? 以下範例將 Edit1 的文字儲存至 .UDL 檔: procedure TForm1.SaveButtonClick(Sender: TObject); var DataInitialize: IDataInitialize; wsFileName, wsConnStr: widestring; begin if Trim(Edit1.Text) = '' then Exit; SaveDialog.InitialDir:= AdoDB.DataLinkDir; // in AdoDB if SaveDialog.Execute then begin wsFileName:= SaveDialog.FileName; wsConnStr:= Edit1.Text; DataInitialize := CreateComObject(CLSID_DataLinks) as IDataInitialize; if Failed(DataInitialize.WriteStringToStorage( PWideChar(wsFileName), PWideChar(wsConnStr), CREATE_ALWAYS)) then raise Exception.Create('Can''t write UDL file.'); end; end;