亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? recerrorform.pas

?? Delphi Kylix Database Development 附書代碼
?? PAS
字號:

{*******************************************************}
{                                                       }
{       Delphi Visual Component Library                 }
{       ClientDataSet Standard Reconcile Error Dialog   }
{                                                       }
{       Copyright (c) 1998 Borland International        }
{                                                       }
{*******************************************************}

{ Note: To use this dialog you should add a call to HandleReconcileError in
  the OnReconcileError event handler of TClientDataSet (see the Client dataset
  demos for an example).  Also, after adding this unit to your project you must
  go into the Project Options dialog and remove this form from the list of
  Auto-created forms or an error will occur when compiling. }

unit RecErrorForm;

interface

uses
  SysUtils, Windows, Variants, Messages, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DB, DBClient, Provider, ExtCtrls;

const
  ActionStr: array[TReconcileAction] of string = ('Skip', 'Abort', 'Merge',
    'Correct', 'Cancel', 'Refresh');
  UpdateKindStr: array[TUpdateKind] of string = ('Modified', 'Inserted',
    'Deleted');
  SCaption = 'Update Error - %s';
  SUnchanged = '<Unchanged>';
  SBinary = '(Binary)';
  SAdt = '(ADT)';
  SArray = '(Array)';
  SFieldName = 'Field Name';
  SOriginal = 'Original Value';
  SConflict = 'Conflicting Value';
  SValue = ' Value';
  SNoData = '<No Records>';
  SNew = 'New';

type
  TReconcileErrorForm = class(TForm)
    UpdateType: TLabel;
    UpdateData: TStringGrid;
    ActionGroup: TRadioGroup;
    CancelBtn: TButton;
    OKBtn: TButton;
    ConflictsOnly: TCheckBox;
    IconImage: TImage;
    ErrorMsg: TMemo;
    ChangedOnly: TCheckBox;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure UpdateDataSetEditText(Sender: TObject; ACol, ARow: Integer;
      const Value: string);
    procedure DisplayFieldValues(Sender: TObject);
    procedure UpdateDataSelectCell(Sender: TObject; Col, Row: Integer;
      var CanSelect: Boolean);
  private
    FDataSet: TDataSet;
    FError: EReconcileError;
    FUpdateKind: TUpdateKind;
    FDataFields: TList;
    FCurColIdx: Integer;
    FNewColIdx: Integer;
    FOldColIdx: Integer;
    procedure AdjustColumnWidths;
    procedure InitDataFields;
    procedure InitUpdateData(HasCurValues: Boolean);
    procedure InitReconcileActions;
    procedure SetFieldValues(DataSet: TDataSet);
  public
    constructor CreateForm(DataSet: TDataSet; UpdateKind: TUpdateKind;
      Error: EReconcileError);
  end;

function HandleReconcileError(DataSet: TDataSet;  UpdateKind: TUpdateKind;
  ReconcileError: EReconcileError): TReconcileAction;

implementation

{$R *.dfm}

type
  PFieldData = ^TFieldData;
  TFieldData = record
    Field: TField;
    NewValue: string;
    OldValue: string;
    CurValue: string;
    EditValue: string;
    Edited: Boolean;
  end;

{ Public and Private Methods }

function HandleReconcileError(DataSet: TDataSet; UpdateKind: TUpdateKind;
  ReconcileError: EReconcileError): TReconcileAction;
var
  UpdateForm: TReconcileErrorForm;
begin
  UpdateForm := TReconcileErrorForm.CreateForm(DataSet, UpdateKind, ReconcileError);
  with UpdateForm do
  try
    if ShowModal = mrOK then
    begin
      Result := TReconcileAction(ActionGroup.Items.Objects[ActionGroup.ItemIndex]);
      if Result = raCorrect then SetFieldValues(DataSet);
    end else
      Result := raAbort;
  finally
    Free;
  end;
end;

{ Routine to convert a variant value into a string.
  Handles binary fields types and "empty" (Unchanged) field values specially }

function VarToString(V: Variant; DataType: TFieldType): string;
const
  BinaryDataTypes: set of TFieldType = [ftBytes, ftVarBytes, ftBlob,
    ftGraphic..ftCursor];
begin
  try
    if VarIsClear(V) then
      Result := SUnchanged
    else if DataType in BinaryDataTypes then
      Result := SBinary
    else if DataType in [ftAdt] then
      Result := SAdt
    else if DataType in [ftArray] then
      Result := SArray
    else
      Result := VarToStr(V);
  except
    on E: Exception do
      Result := E.Message;
  end;
end;

{ TReconcileErrorForm }

constructor TReconcileErrorForm.CreateForm(DataSet: TDataSet;
  UpdateKind: TUpdateKind; Error: EReconcileError);
begin
  FDataSet := DataSet;
  FUpdateKind := UpdateKind;
  FError := Error;
  inherited Create(Application);
end;

{ Create a list of the data fields in the dataset, and store string values
  associated with NewValue, OldValue, and CurValue in string variables
  to make display switching faster }

procedure TReconcileErrorForm.InitDataFields;
var
  I: Integer;
  FD: PFieldData;
  V: Variant;
  HasCurValues: Boolean;
begin
  HasCurValues := False;
  for I := 0 to FDataSet.FieldCount - 1 do
  with FDataset.Fields[I] do
  begin
    if (FieldKind <> fkData) then Continue;
    FD := New(PFieldData);
    try
      FD.Field := FDataset.Fields[I];
      FD.Edited := False;
      if FUpdateKind <> ukDelete then
        FD.NewValue := VarToString(NewValue, DataType);
      V := CurValue;
      if not VarIsClear(V) then HasCurValues := True;
      FD.CurValue := VarToString(CurValue, DataType);
      if FUpdateKind <> ukInsert then
        FD.OldValue := VarToString(OldValue, DataType);
      FDataFields.Add(FD);
    except
      Dispose(FD);
      raise;
    end;
  end;
  InitUpdateData(HasCurValues);
end;

{ Initialize the column indexes and grid titles }

procedure TReconcileErrorForm.InitUpdateData(HasCurValues: Boolean);
var
  FColCount: Integer;
begin
  FColCount := 1;
  UpdateData.ColCount := 4;
  UpdateData.Cells[0,0] := SFieldName;
  if FUpdateKind <> ukDelete then
  begin
    FNewColIdx := FColCount;
    Inc(FColCount);
    UpdateData.Cells[FNewColIdx,0] := UpdateKindStr[FUpdateKind] + SValue;
  end else
  begin
    FOldColIdx := FColCount;
    Inc(FColCount);
    UpdateData.Cells[FOldColIdx,0] := SOriginal;
  end;
  if HasCurValues then
  begin
    FCurColIdx := FColCount;
    Inc(FColCount);
    UpdateData.Cells[FCurColIdx,0] := SConflict;
  end;
  if FUpdateKind = ukModify then
  begin
    FOldColIdx := FColCount;
    Inc(FColCount);
    UpdateData.Cells[FOldColIdx,0] := SOriginal;
  end;
  UpdateData.ColCount := FColCount;
end;

{ Update the reconcile action radio group based on the valid reconcile actions }

procedure TReconcileErrorForm.InitReconcileActions;

  procedure AddAction(Action: TReconcileAction);
  begin
    ActionGroup.Items.AddObject(ActionStr[Action], TObject(Action));
  end;

begin
  AddAction(raSkip);
  AddAction(raCancel);
  AddAction(raCorrect);
  if FCurColIdx > 0 then
  begin
    AddAction(raRefresh);
    AddAction(raMerge);
  end;
  ActionGroup.ItemIndex := 0;
end;

{ Update the grid based on the current display options }

procedure TReconcileErrorForm.DisplayFieldValues(Sender: TObject);
var
  I: Integer;
  CurRow: Integer;
  Action: TReconcileAction;
begin
  if not Visible then Exit;
  Action := TReconcileAction(ActionGroup.Items.Objects[ActionGroup.ItemIndex]);
  UpdateData.Col := 1;
  UpdateData.Row := 1;
  CurRow := 1;
  UpdateData.RowCount := 2;
  UpdateData.Cells[0, CurRow] := SNoData;
  for I := 1 to UpdateData.ColCount - 1 do
    UpdateData.Cells[I, CurRow] := '';
  for I := 0 to FDataFields.Count - 1 do
    with PFieldData(FDataFields[I])^ do
    begin
      if ConflictsOnly.Checked and (CurValue = SUnChanged) then Continue;
      if ChangedOnly.Checked and (NewValue = SUnChanged) then Continue;
      UpdateData.RowCount := CurRow + 1;
      UpdateData.Cells[0, CurRow] := Field.DisplayName;
      if FNewColIdx > 0 then
      begin
        case Action of
          raCancel, raRefresh:
            UpdateData.Cells[FNewColIdx, CurRow] := SUnChanged;
          raCorrect:
            if Edited then
              UpdateData.Cells[FNewColIdx, CurRow] := EditValue else
              UpdateData.Cells[FNewColIdx, CurRow] := NewValue;
          else
            UpdateData.Cells[FNewColIdx, CurRow] := NewValue;
        end;
        UpdateData.Objects[FNewColIdx, CurRow] := FDataFields[I];
      end;
      if FCurColIdx > 0 then
        UpdateData.Cells[FCurColIdx, CurRow] := CurValue;
      if FOldColIdx > 0 then
        if (Action in [raMerge, raRefresh]) and (CurValue <> SUnchanged) then
           UpdateData.Cells[FOldColIdx, CurRow] := CurValue else
           UpdateData.Cells[FOldColIdx, CurRow] := OldValue;
      Inc(CurRow);
    end;
  AdjustColumnWidths;
end;

{ For fields that the user has edited, copy the changes back into the
  NewValue property of the associated field }

procedure TReconcileErrorForm.SetFieldValues(DataSet: TDataSet);
var
  I: Integer;
begin
  for I := 0 to FDataFields.Count - 1 do
    with PFieldData(FDataFields[I])^ do
      if Edited then Field.NewValue := EditValue;
end;

procedure TReconcileErrorForm.AdjustColumnWidths;
var
  NewWidth, I: integer;
begin
  with UpdateData do
  begin
    NewWidth := (ClientWidth - ColWidths[0]) div (ColCount - 1);
    for I := 1 to ColCount - 1 do
      ColWidths[I] := NewWidth - 1;
  end;
end;

{ Event handlers }

procedure TReconcileErrorForm.FormCreate(Sender: TObject);
begin
  if FDataSet = nil then Exit;
  FDataFields := TList.Create;
  InitDataFields;
  Caption := Format(SCaption, [FDataSet.Name]);
  UpdateType.Caption := UpdateKindStr[FUpdateKind];
  ErrorMsg.Text := FError.Message;
  if FError.Context <> '' then
    ErrorMsg.Lines.Add(FError.Context);
  ConflictsOnly.Enabled := FCurColIdx > 0;
  ConflictsOnly.Checked := ConflictsOnly.Enabled;
  ChangedOnly.Enabled := FNewColIdx > 0;
  InitReconcileActions;
  UpdateData.DefaultRowHeight := UpdateData.Canvas.TextHeight('SWgjp') + 7; { Do not localize }
end;

procedure TReconcileErrorForm.FormDestroy(Sender: TObject);
var
  I: Integer;
begin
  if Assigned(FDataFields) then
  begin
    for I := 0 to FDataFields.Count - 1 do
      Dispose(PFieldData(FDataFields[I]));
    FDataFields.Destroy;
  end;
end;

{ Set the Edited flag in the DataField list and save the value }

procedure TReconcileErrorForm.UpdateDataSetEditText(Sender: TObject; ACol,
  ARow: Integer; const Value: string);
begin
  PFieldData(UpdateData.Objects[ACol, ARow]).EditValue := Value;
  PFieldData(UpdateData.Objects[ACol, ARow]).Edited := True;
end;

{ Enable the editing in the grid if we are on the NewValue column and the
  current reconcile action is raCorrect }

procedure TReconcileErrorForm.UpdateDataSelectCell(Sender: TObject; Col,
  Row: Integer; var CanSelect: Boolean);
begin
  if (Col = FNewColIdx) and
    (TReconcileAction(ActionGroup.Items.Objects[ActionGroup.ItemIndex]) = raCorrect) then
    UpdateData.Options := UpdateData.Options + [goEditing] else
    UpdateData.Options := UpdateData.Options - [goEditing];
end;

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩色综合| 亚洲精品你懂的| 亚洲精品国产品国语在线app| 亚洲国产一区二区a毛片| 国产综合色视频| 欧美日韩视频在线第一区| 亚洲国产精品黑人久久久| 蜜桃一区二区三区四区| 91官网在线免费观看| 国产目拍亚洲精品99久久精品| 午夜视频一区二区| 99视频超级精品| 久久久国产精品不卡| 日韩成人精品在线观看| 色婷婷综合久久久久中文一区二区 | 欧美一卡2卡3卡4卡| 亚洲欧洲国产日韩| 懂色av一区二区三区蜜臀| 精品国产凹凸成av人导航| 亚洲成人www| 欧美亚洲国产一区二区三区| 亚洲少妇30p| 99国产精品久久久久久久久久| 久久久www成人免费毛片麻豆| 久久精品国内一区二区三区| 6080亚洲精品一区二区| 亚洲动漫第一页| 欧美日韩国产首页| 亚洲电影欧美电影有声小说| 欧美性猛交xxxx乱大交退制版| 亚洲男女毛片无遮挡| 91亚洲精品乱码久久久久久蜜桃| 久久久久久久综合| 国产一区二区h| 国产日韩亚洲欧美综合| 国产成人精品免费网站| 国产视频视频一区| 国产白丝网站精品污在线入口 | 制服丝袜中文字幕一区| 亚洲电影在线播放| 91.com在线观看| 另类综合日韩欧美亚洲| 久久久国产午夜精品| 波多野结衣精品在线| 亚洲欧美日韩国产综合在线| 91蝌蚪porny| 亚洲gay无套男同| 欧美一区二区成人| 国产精品自产自拍| 国产精品久久网站| 欧美性淫爽ww久久久久无| 天天操天天干天天综合网| 欧美嫩在线观看| 黑人巨大精品欧美一区| 国产午夜精品在线观看| 欧洲亚洲精品在线| 麻豆91精品91久久久的内涵| 国产精品久久久久aaaa| 欧美日韩激情一区二区三区| 久久99久久精品| 亚洲欧美在线高清| 宅男在线国产精品| 国产精品99久久久久久久vr| 亚洲人午夜精品天堂一二香蕉| 欧美日韩三级一区二区| 国产酒店精品激情| 一区二区三区四区高清精品免费观看 | 亚洲一区二区在线观看视频| 91麻豆精品国产综合久久久久久| 国产麻豆成人精品| 亚洲黄色av一区| 欧美成人vr18sexvr| 91免费观看视频| 蜜臀久久99精品久久久久久9| 欧美高清在线视频| 欧美老肥妇做.爰bbww| 丁香婷婷综合激情五月色| 亚洲高清一区二区三区| 国产亚洲成av人在线观看导航| 日本道色综合久久| 国产风韵犹存在线视精品| 亚洲bt欧美bt精品| 1000精品久久久久久久久| 日韩欧美国产一区二区在线播放 | 91精品国产免费久久综合| 成人综合婷婷国产精品久久蜜臀 | 欧美性感一区二区三区| 国产精品亚洲а∨天堂免在线| 爽好多水快深点欧美视频| 中文字幕在线观看不卡| 精品美女一区二区| 欧美美女视频在线观看| 91视频在线看| 成人h版在线观看| 国产一区二区在线观看免费| 午夜精品久久一牛影视| 日韩理论片中文av| 中文字幕 久热精品 视频在线| 日韩丝袜美女视频| 欧美精品乱码久久久久久按摩| 色999日韩国产欧美一区二区| 岛国精品在线播放| 国产激情精品久久久第一区二区| 日韩成人精品在线观看| 亚洲成人精品在线观看| 亚洲一区二区在线播放相泽 | 精品一区二区免费视频| 日日夜夜免费精品视频| 天堂蜜桃一区二区三区| 一区二区三区高清在线| 亚洲免费在线看| 夜夜嗨av一区二区三区网页| 亚洲欧美激情一区二区| 亚洲免费观看高清完整版在线观看熊 | 在线观看91视频| 欧美三级日韩三级国产三级| 欧美午夜精品电影| 欧美性videosxxxxx| 欧美色视频一区| 6080日韩午夜伦伦午夜伦| 91精品国产91久久综合桃花| 欧美一级欧美一级在线播放| 日韩欧美成人激情| 欧美成人一区二区| 久久综合资源网| 国产精品女上位| 亚洲青青青在线视频| 夜夜嗨av一区二区三区中文字幕| 亚洲午夜电影网| 免费的成人av| 国产一区二区在线影院| 成人黄色a**站在线观看| 色婷婷综合在线| 欧美一二三区在线| 久久久亚洲精华液精华液精华液| 中文字幕乱码久久午夜不卡| 亚洲欧美一区二区三区孕妇| 日韩精品一级二级 | 奇米色一区二区| 国产裸体歌舞团一区二区| 成人免费毛片高清视频| 欧美日韩一区二区三区四区| 欧美xxxxxxxxx| 自拍偷拍国产精品| 亚洲成av人片一区二区梦乃| 国产在线一区二区| 91黄色激情网站| 精品国产伦一区二区三区观看体验 | 欧美日韩国产精品成人| 精品久久人人做人人爰| 国产精品久久精品日日| 日本中文字幕不卡| 国产高清在线精品| 欧美日韩一区二区三区不卡| 国产午夜亚洲精品午夜鲁丝片| 伊人一区二区三区| 精东粉嫩av免费一区二区三区| 99久久精品免费精品国产| 555www色欧美视频| 国产精品日日摸夜夜摸av| 日本特黄久久久高潮| aaa国产一区| 精品国产一区二区三区久久影院| 亚洲精品久久7777| 国产乱对白刺激视频不卡| 欧美亚日韩国产aⅴ精品中极品| 欧美成人猛片aaaaaaa| 亚洲最大成人综合| 福利视频网站一区二区三区| 91精品国产福利| 亚洲国产精品欧美一二99| 东方aⅴ免费观看久久av| 在线成人免费观看| 亚洲欧美aⅴ...| 高清免费成人av| 久久一区二区三区四区| 亚洲成人自拍一区| 91毛片在线观看| 国产精品家庭影院| 国产91富婆露脸刺激对白| 日韩视频一区二区三区| 亚洲国产成人精品视频| 一本一道综合狠狠老| 国产拍揄自揄精品视频麻豆| 久久国产欧美日韩精品| 在线综合视频播放| 亚洲不卡av一区二区三区| 91在线视频网址| 国产精品成人免费| 国产成人精品亚洲日本在线桃色| 欧美成人精品福利| 免费在线一区观看| 91.麻豆视频| 另类小说综合欧美亚洲| 日韩午夜av一区| 国产在线日韩欧美| 久久久久国产一区二区三区四区 | 国产精品一区久久久久| 日韩视频一区二区三区在线播放| 午夜精品久久久久久久99樱桃|