不知道为什么,原来可以实现的窗体出现了这样的问题,说'Dataset does not support books,which are required for multi-record data contorls',这是为什么?book又是什么,第一次见过。

解决方案 »

  1.   

    你用的什么数据集,估计这个数据集组件不支持书签  book
      

  2.   

    unit U_ygdd;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, Grids, DBGrids, ComCtrls, Buttons, ToolWin, ExtCtrls, DB,
      StdCtrls;type
      Tfrm_ygdd = class(TForm)
        Panel1: TPanel;
        TreeView1: TTreeView;
        Panel2: TPanel;
        CoolBar1: TCoolBar;
        ToolBar1: TToolBar;
        SpeedButton1: TSpeedButton;
        SpeedButton2: TSpeedButton;
        SpeedButton3: TSpeedButton;
        ToolButton1: TToolButton;
        ToolButton2: TToolButton;
        Panel3: TPanel;
        Panel4: TPanel;
        DBGrid1: TDBGrid;
        BitBtn3: TBitBtn;
        BitBtn2: TBitBtn;
        Label1: TLabel;
        Label2: TLabel;
        Label3: TLabel;
        Label4: TLabel;
        Label5: TLabel;
        Edit1: TEdit;
        Edit2: TEdit;
        ComboBox1: TComboBox;
        ComboBox2: TComboBox;
        ComboBox3: TComboBox;
        DataSource1: TDataSource;
        procedure SpeedButton1Click(Sender: TObject);
        procedure SpeedButton3Click(Sender: TObject);
        procedure TreeView1Click(Sender: TObject);
        procedure FormShow(Sender: TObject);
        procedure BitBtn3Click(Sender: TObject);
        procedure DBGrid1CellClick(Column: TColumn);
        procedure BitBtn2Click(Sender: TObject);
        procedure SpeedButton2Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      frm_ygdd: Tfrm_ygdd;implementationuses U_data,U_tj;{$R *.dfm}procedure Tfrm_ygdd.SpeedButton1Click(Sender: TObject);
    begin
    application.CreateForm(Tfrm_cxtj,frm_cxtj);
    frm_cxtj.ShowModal;
    frm_cxtj.Free;
    end;procedure Tfrm_ygdd.SpeedButton3Click(Sender: TObject);
    begin
    close;
    end;procedure Tfrm_ygdd.TreeView1Click(Sender: TObject);
    var
    s,d:string;
    begin
    with data1.ADOQYdwxx do
       begin
          close;
          sql.Clear;
          sql.Add('select distinct 单位名称 from 单位信息表');
          open;
       end;
    s:=treeview1.Selected.Text;
    d:=data1.ADOQYdwxx.FieldByName('单位名称').Value;
    if treeview1.Selected<>nil then
       if treeview1.Selected.Text=d then
          begin
          with data1.ADOpublic do
             begin
                close;
                sql.Clear;
                sql.Add('select * from 人事表 where sflz=:b ');
                parameters.ParamByName('b').Value:='否';
                open;
             end;
          end
       else
          begin
             with data1.ADOpublic do
             begin
                close;
                sql.Clear;
                sql.Add('select * from 人事表 where ssbm= :a and sflz=:b ');
                parameters.ParamByName('a').Value:=s;
                parameters.ParamByName('b').Value:='否';
                open;
             end;
          end;
    end;procedure Tfrm_ygdd.FormShow(Sender: TObject);
    var
    a,b:string;
    subt:TTreenode;
    begin
    combobox1.Clear;
    combobox2.Clear;
    combobox3.Clear;
    with data1.ADOpublic do
       begin
          close;
          sql.Clear;
          sql.Add('select distinct 单位名称 from 单位信息表');
          open;
       end;
       a:=data1.ADOpublic.FieldByName('单位名称').Value;
       subt:=Treeview1.Items.Add(nil,a);
    with data1.ADOpublic do
       begin
          close;
          sql.Clear;
          sql.Add('select distinct 部门名称 from 部门表');
          open;
       end;
       while Not Data1.ADOpublic.Eof do
       begin
         ComboBox1.Items.Add(Data1.ADOpublic.FieldByName('部门名称').Value);
         b:=Data1.ADOpublic.FieldByName('部门名称').Value;
         Data1.ADOpublic.Next;
         Treeview1.Items.AddChild(subt,b);
       end;
    with data1.ADOpublic do
       begin
          close;
          sql.Clear;
          sql.Add('select distinct 职务名称 from 职务表');
          open;
       end;
       while Not Data1.ADOpublic.Eof do
       begin
         ComboBox2.Items.Add(Data1.ADOpublic.FieldByName('职务名称').Value);
         Data1.ADOpublic.Next;
       end;
    with data1.ADOpublic do
       begin
          close;
          sql.Clear;
          sql.Add('select distinct 职称名称 from 职称表');
          open;
       end;
       while Not Data1.ADOpublic.Eof do
       begin
         ComboBox3.Items.Add(Data1.ADOpublic.FieldByName('职称名称').Value);
         Data1.ADOpublic.Next;
       end;
    with data1.ADOpublic do
       begin
          close;
          sql.Clear;
          sql.Add('select * from 人事表 where sflz= :b');
          parameters.ParamByName('b').Value:='否';
          open;
       end;
       data1.ADOpublic.Active:=true;
       edit1.Text:=data1.ADOpublic.FieldByName('bh').Value;
       edit2.Text:=data1.ADOpublic.FieldByName('xm').Value;
       combobox1.Text:=data1.ADOpublic.FieldByName('ssbm').Value;
       combobox2.Text:=data1.ADOpublic.FieldByName('zw').Value;
       combobox3.Text:=data1.ADOpublic.FieldByName('zc').Value;
       TreeView1.FullExpand;
    end;procedure Tfrm_ygdd.BitBtn3Click(Sender: TObject);
    begin
    combobox1.Enabled:=true;
    combobox2.Enabled:=true;
    combobox3.Enabled:=true;
    end;procedure Tfrm_ygdd.DBGrid1CellClick(Column: TColumn);
    begin
    If DBGrid1.DataSource.DataSet<> Nil then
        if DBGrid1.DataSource.DataSet.RecordCount>0 then
          begin
          edit1.Text:=data1.ADOpublic.FieldByName('bh').Value;
          edit2.Text:=data1.ADOpublic.FieldByName('xm').Value;
          combobox1.Text:=data1.ADOpublic.FieldByName('ssbm').Value;
          combobox2.Text:=data1.ADOpublic.FieldByName('zw').Value;
          combobox3.Text:=data1.ADOpublic.FieldByName('zc').Value;
          end;
    end;procedure Tfrm_ygdd.BitBtn2Click(Sender: TObject);
    begin
    try
    with data1.ADOpublic do
       begin
          edit;
          FieldByName('ssbm').Value := Trim(combobox1.Text);
          FieldByName('zw').Value := Trim(combobox2.Text);
          FieldByName('zc').Value := Trim(combobox3.Text);
          post
       end;
          bitbtn3.OnClick(sender);
          application.MessageBox('修改成功','提示',64);
    except
       application.MessageBox('修改失败','提示',64);
       close;
    end;
    end;procedure Tfrm_ygdd.SpeedButton2Click(Sender: TObject);
    begin
    with data1.ADOpublic do
       begin
          close;
          sql.Clear;
          sql.Add('select * from 人事表 where sflz=:b ');
          parameters.ParamByName('b').Value:='否';
          open;
       end
    end;
    end.以上就是我这个窗体里的代码
      

  3.   

    你看一下你的sql 语句或者早adoquery的CursorLocation属性设置为clUseClient
      

  4.   

    adoquery的CursorLocation属性 设为clUseClient;