[delphi]Dataset does not support bookmarks……

大容 2012-06-06 09:02:49
不知道为什么,原来可以实现的窗体出现了这样的问题,说'Dataset does not support bookmarks,which are required for multi-record data contorls',这是为什么?bookmark又是什么,第一次见过。
...全文
618 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
beifangke 2014-01-15
  • 打赏
  • 举报
回复 1
adoquery的CursorLocation属性 设为clUseClient;
爱生活爱运动 2013-04-03
  • 打赏
  • 举报
回复
你看一下你的sql 语句 或者早adoquery的CursorLocation属性设置为clUseClient
大容 2012-06-06
  • 打赏
  • 举报
回复
unit U_ygdd;

interface

uses
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;

implementation

uses 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.

以上就是我这个窗体里的代码
大容 2012-06-06
  • 打赏
  • 举报
回复
什么是数据集组件,其它窗体都是同样的做法,都没问题的
bdmh 2012-06-06
  • 打赏
  • 举报
回复
你用的什么数据集,估计这个数据集组件不支持书签 bookmark

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧