unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ComCtrls, DB, ADODB;type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
ADOQuery2: TADOQuery;
TreeView1: TTreeView;
SpeedButton1: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.SpeedButton1Click(Sender: TObject);
var
node:TTreeNode;
begin
TreeView1.Items.Clear;
node:=TreeView1.Items.Add(nil,'sss');
with ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('select distinct gloType from collects');
open;
if not eof then
with ADOQuery2 do
begin
close;
sql.Clear;
sql.Add('select distinct Title from collects where gloType= '+ADOQuery1.fieldbyname('glotype').asstring);
open;
end; end;end;end.
--------------------------------------------------------------------
错误提示:参数 软件下载 没有默认值
--------------------------------------------------------------------
有没有可能是数据库设置的问题????
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ComCtrls, DB, ADODB;type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
ADOQuery2: TADOQuery;
TreeView1: TTreeView;
SpeedButton1: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.SpeedButton1Click(Sender: TObject);
var
node:TTreeNode;
begin
TreeView1.Items.Clear;
node:=TreeView1.Items.Add(nil,'sss');
with ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('select distinct gloType from collects');
open;
if not eof then
with ADOQuery2 do
begin
close;
sql.Clear;
sql.Add('select distinct Title from collects where gloType= '+ADOQuery1.fieldbyname('glotype').asstring);
open;
end; end;end;end.
--------------------------------------------------------------------
错误提示:参数 软件下载 没有默认值
--------------------------------------------------------------------
有没有可能是数据库设置的问题????
这句有问题,该为:
sql.Add('select distinct Title from collects where gloType= '+quoted(ADOQuery1.fieldbyname('glotype').asstring));