我用一个TTreeView控件来显示数据库里的表记录,这里有个公用函数是用来添加TTreeView里的树状结构,
procedure TQuotationForm.AddTreeView;
var
StrSQL,StrSQL1,StrSQL2 : String;
Temp,ChildTemp : TTreeNode;
StrQuotation,StrLabour,StrPart : String;
begin
with MainForm.MainADOQU1 do
begin
StrSQL := 'select * from quotation '; with MainForm.MainADOQU1 do
begin
Close;
SQL.Text := StrSQL;
Open; if not Eof then
begin
QuotationTV.Items.Clear; First; while not Eof do
begin
StrQuotation := FieldByName('quota_id').AsString;//这里是quotation表里记录ID值 Temp := QuotationTV.Items.Add(Nil,StrQuotation);//给TTreeview加显示记录 if OperateQuotation<>'' then //OperateQuotation是公用变量,不为空时就想让相对的记录项在TTreeView里变为被选择了的状态
begin
if StrQuotation=OperateQuotation then
begin
//应该怎么写呢?是QuotationTV.Items.Selected:=enable?但运行结果是错的
//我是这方面的新手,不知道怎么让quotation表中ID值与OperateQuotation变量相等的显示项变成已被选择,有哪位高手能帮一下我?谢谢
end;
end;先谢谢大家了!
procedure TQuotationForm.AddTreeView;
var
StrSQL,StrSQL1,StrSQL2 : String;
Temp,ChildTemp : TTreeNode;
StrQuotation,StrLabour,StrPart : String;
begin
with MainForm.MainADOQU1 do
begin
StrSQL := 'select * from quotation '; with MainForm.MainADOQU1 do
begin
Close;
SQL.Text := StrSQL;
Open; if not Eof then
begin
QuotationTV.Items.Clear; First; while not Eof do
begin
StrQuotation := FieldByName('quota_id').AsString;//这里是quotation表里记录ID值 Temp := QuotationTV.Items.Add(Nil,StrQuotation);//给TTreeview加显示记录 if OperateQuotation<>'' then //OperateQuotation是公用变量,不为空时就想让相对的记录项在TTreeView里变为被选择了的状态
begin
if StrQuotation=OperateQuotation then
begin
//应该怎么写呢?是QuotationTV.Items.Selected:=enable?但运行结果是错的
//我是这方面的新手,不知道怎么让quotation表中ID值与OperateQuotation变量相等的显示项变成已被选择,有哪位高手能帮一下我?谢谢
end;
end;先谢谢大家了!
解决方案 »
- 高分求web日志挖掘的源代码,分数不够可以再加,急急急!!!
- 微软 2004-11-13 笔试题解析
- 关于事务的问题
- 怎么做一个运行以后没窗口的程序?
- access数据库中的备注的字段类型怎样在delphi中转换?
- 不知哪位兄弟有水晶报表8.5版本的中文说明?
- 帮偶找回WIN2000 SERVER,5555555
- VB与Delphi的共存问题?
- 为了学习多层数据库,我安装了Win2000server,但是服务器要如何配置?我没用过server.帮我一把,我是菜鸟。
- 请问怎样才能关闭一个外部程序?
- 初学:求一般SQL(带字符串变量操作)
- 各位,进来看看如何对excel进行行合并啊!!!!!!!!!!!!!!!!!!
编译不过啊,应该不是QuotationTV.Items开头的了