S
sjw74
Unregistered / Unconfirmed
GUEST, unregistred user!
在使用TreeView实现树状列表过程中,选择节点并要提取显示数据时,第一
次没有错,但第二次总是显示出现‘没有当前记录’的错误,兄弟实在没辙
了。
请各位大哥指点一二。
具体出错提示:Project project1.exe raised exception class
EDbEngineError with message 'No Current
Record' Process Stopped.
具体程序:
// Country 库表中‘国家’字段
// City 库表中‘城市’字段
// Company 库表中‘公司’字段
// Scountry,Scity是全局String变量
procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
Var node:TtreeNode;
str:string;
begin
Node:=TreeView1.GetNodeAt(x,y);
if Node<>nil then
str:= Node.Text;
try
case node.Level of
0:Begin
table1.Filter :='Country = '+''''+str+'''';
table1.Filtered :=true;
DataSource1.Enabled :=true;
End;
1:begin
Scountry:=Node.Parent.Text;
table1.Filter :='City = '+''''+str+''''+' and Country = '+''''+Scountry+'''';
table1.Filtered :=true;
DataSource1.Enabled :=true;
end;
2:begin
Scountry:=Node.Parent.Parent.Text;
Scity:=Node.parent.Text;
table1.Filter :='Company = '+''''+str+''''+' and Country = '+''''+Scountry+''''+' and City = '+''''+Scity+'''';
table1.Filtered :=true;
DataSource1.Enabled :=true;
end;
else
end;
except
node.Free;
end;
end;
请详加指正,多谢.多谢.多谢......
次没有错,但第二次总是显示出现‘没有当前记录’的错误,兄弟实在没辙
了。
请各位大哥指点一二。
具体出错提示:Project project1.exe raised exception class
EDbEngineError with message 'No Current
Record' Process Stopped.
具体程序:
// Country 库表中‘国家’字段
// City 库表中‘城市’字段
// Company 库表中‘公司’字段
// Scountry,Scity是全局String变量
procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
Var node:TtreeNode;
str:string;
begin
Node:=TreeView1.GetNodeAt(x,y);
if Node<>nil then
str:= Node.Text;
try
case node.Level of
0:Begin
table1.Filter :='Country = '+''''+str+'''';
table1.Filtered :=true;
DataSource1.Enabled :=true;
End;
1:begin
Scountry:=Node.Parent.Text;
table1.Filter :='City = '+''''+str+''''+' and Country = '+''''+Scountry+'''';
table1.Filtered :=true;
DataSource1.Enabled :=true;
end;
2:begin
Scountry:=Node.Parent.Parent.Text;
Scity:=Node.parent.Text;
table1.Filter :='Company = '+''''+str+''''+' and Country = '+''''+Scountry+''''+' and City = '+''''+Scity+'''';
table1.Filtered :=true;
DataSource1.Enabled :=true;
end;
else
end;
except
node.Free;
end;
end;
请详加指正,多谢.多谢.多谢......