不知道為什么,原來可以實作的表單出現了這樣的問題,說'Dataset does not support bookmarks,which are required for multi-record data contorls',這是為什么?bookmark又是什么,第一次見過。
uj5u.com熱心網友回復:
你用的什么資料集,估計這個資料集組件不支持書簽 bookmarkuj5u.com熱心網友回復:
什么是資料集組件,其它表單都是同樣的做法,都沒問題的uj5u.com熱心網友回復:
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.
以上就是我這個表單里的代碼
uj5u.com熱心網友回復:
你看一下你的sql 陳述句或者早adoquery的CursorLocation屬性設定為clUseClient
uj5u.com熱心網友回復:
adoquery的CursorLocation屬性 設為clUseClient;轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/117347.html
標籤:語言基礎/算法/系統設計
上一篇:學渣求助
下一篇:RIFID 貼紙讀入程式
