袁绍伦
路人甲
路人甲
  • 注册日期2003-08-08
  • 发帖数654
  • QQ164646905
  • 铜币1336枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1344回复:0

Delphi Example of a NotesQuery Dataset

楼主#
更多 发布于:2003-09-03 21:41
procedure TMapForm.NotesQueryButtonClick(Sender: TObject);
var
 NQI: Variant;
 ds: Dataset;
 flds: CMapXFields;
begin
 try
  { Create a new NotesQueryInfo object;
    CreateOleObject is found in the 'ComObj' package }
  NQI := CreateOleObject('MapX.NotesQueryInfo.4');

  { Change this to point to the appropriate server and
    database; a sample database is included on the MapX CD.
    Leave the Server field empty if accessing a local
    database }
  NQI.Server := '';

  NQI.Database := 'C:\Windows\Desktop\LotusNotes\Notesamp.nsf';
  NQI.Query := '@All'; { Or some other appropriate Notes query
  for example '@ismember(State;"NY":"TX":"CA":"FL")' }

  { Create a new Fields object and use it to describe the
    fields we are going to import. Using a Fields object is
    required for NotesQuery datasets. }
  flds := CoFields.Create;
  flds.Add('State', 'State', miAggregationIndividual, miTypeString);
  flds.Add('Value', 'Value', miAggregationSum, miTypeNumeric);

  ds := Map1.Datasets.Add(miDataSetNotesQuery, NQI, 'NotesDS', 'State', EmptyParam, EmptyParam, flds, EmptyParam);

  ds.Themes.Add(miThemeRanged, 'Value', 'NotesThematic', EmptyParam);
 except
  on E: EOleException do
   Application.MessageBox(PChar(E.Message), 'Error',
    MB_OK or MB_ICONERROR);
 end;
end;
喜欢0 评分0
愿意和大家交朋友! QQ:47559983 MSN:shaolun_yuan@hotmail.com eMail:shaolun-yuan@163.com
游客

返回顶部