小白问题incompatible types
type
TArr = array of string;
Tbbzprintform = class(TForm)
DBGrid1: TDBGrid;
ComboBox1: TComboBox;
Button1: TButton;
Button2: TButton;
lfQuery: TADOQuery;
DataSource1: TDataSource;
procedure FormCreate(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
bbzprintform: Tbbzprintform;
// FieldName: String;
implementation
uses Unit6;
{$R *.dfm}
procedure Tbbzprintform.FormCreate(Sender: TObject);
begin
//ComboBox1.Text:='未打印';
ComboBox1.Items.Add('未打印');
ComboBox1.Items.Add('已打印');
ComboBox1.Items.Add('全部');
end;
procedure Tbbzprintform.ComboBox1Change(Sender: TObject);
begin
lfQuery.Close;
lfQuery.SQL.Clear;
if ComboBox1.Text='全部' then
Begin
lfQuery.SQL.Add('select * from driverinfo');
lfQuery.ExecSQL;
lfQuery.Open;
end
else
if ComboBox1.Text='未打印' then
Begin
lfQuery.SQL.Add('select * from driverinfo where d_print=:False');
lfQuery.ExecSQL;
lfQuery.Open;
end
else
if ComboBox1.Text='已打印' then
begin
lfQuery.SQL.Add('select * from driverinfo where d_print=:True');
lfQuery.ExecSQL;
lfQuery.Open;
end;
end;
procedure Tbbzprintform.Button1Click(Sender: TObject);
Var
j: Integer;
i: Integer;
arr:TArr;
begin
dbgrid1.datasource.dataset.Active:=True;
dbgrid1.datasource.dataset.first;
while not dbgrid1.datasource.dataset.eof do
begin
for j := 0 to dbgrid1.datasource.dataset.fieldcount -1 do
begin
arr[i][j] := dbgrid1.datasource.dataset.fields[j].asstring;//报错:incompatible types:'char' and 'string'
end;
dbgrid1.datasource.dataset.next;
end;
end;
end.
我是初学者,小白一个
把dbgrid里的值存到数组中