procedure TForm1.Button6Click(Sender: TObject);
var
sql, Str, Price: string;
i, p1, P2: Integer;
Money : Double;
begin
Str := '';
Money := 0;
Str := ComboBox1.Text;
sql := 'Select * from Information where dCtry = ' + quotedstr(Str);
ADOQuery6.Close;
ADOQuery6.sql.Clear;
ADOQuery6.sql.Add(sql);
ADOQuery6.open;
for i := 0 to ADOQuery6.RecordCount do
begin
Price := ADOQuery6.FieldByName('dsPrice').AsString;
p1 := Pos('-', Price);
if p1 > 1 then
Price := Copy(Price, p1 + 1, Length(Price));
P2 := Pos('US$', Price);
Price := Copy(Price, P2 + Length('US$'), Length(Price));
Price := Trim(Price);
Money := StrToFloat(Price);
ADOQuery6.Next;
end;
end;
大家帮忙看下。我得到的Money 结果居然是0.无结果。怎么回事啊?没看到什么问题啊!
var
sql, Str, Price: string;
i, p1, P2: Integer;
Money : Double;
begin
Str := '';
Money := 0;
Str := ComboBox1.Text;
sql := 'Select * from Information where dCtry = ' + quotedstr(Str);
ADOQuery6.Close;
ADOQuery6.sql.Clear;
ADOQuery6.sql.Add(sql);
ADOQuery6.open;
for i := 0 to ADOQuery6.RecordCount do
begin
Price := ADOQuery6.FieldByName('dsPrice').AsString;
p1 := Pos('-', Price);
if p1 > 1 then
Price := Copy(Price, p1 + 1, Length(Price));
P2 := Pos('US$', Price);
Price := Copy(Price, P2 + Length('US$'), Length(Price));
Price := Trim(Price);
Money := StrToFloat(Price);
ADOQuery6.Next;
end;
end;
大家帮忙看下。我得到的Money 结果居然是0.无结果。怎么回事啊?没看到什么问题啊!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货