怎么将数据库的一个fields赋值给变量!在线等............(50分)

  • 主题发起人 主题发起人 igghdee
  • 开始时间 开始时间
I

igghdee

Unregistered / Unconfirmed
GUEST, unregistred user!
//input:array[0..5] of single
With Adotable1.Recordset do
begin
If input1 < Fields[j + 3] then //[Error] Unit1.pas(109): Incompatible types
a:=a+5;
end;
为什么,错在哪里,谢了!
 
var i:integer;
begin
adotable1.First
for i:=0 to adotable1.RecordCount-1 do
begin
If input1 < Fields[j + 3] then //这里楼主自己写吧
a:=a+5;
adotable1.Next;
end;
end;
不知道是不是楼主要的效果。。。。
 
If input1.AsFloat < Fields[j + 3].AsFloat

莫非楼主希望TField实现了操作符重载功能?TField是类啊,老大。
 
照楼上的作,用.asfloat结果:[Error] Unitjudge.pas(109): Record, object or class type required
 
看错题了,哈哈。
If input1 < Fields[j + 3].AsFloat
//input1本来就是Single数组,而Fields则是对象。
 
[Error] Unitjudge.pas(109): Undeclared identifier: 'AsFloat'
 
var i:integer;
input:array[0..5] of Double;
begin
input[x]:=x...
......
adotable1.First;
for i:=0 to adotable1.RecordCount-1 do
begin
If input1< ADOtable1.Fields.AsFloat then //记录条数和字段数不能大于数组长度
a:=a+5;
adotable1.Next;
end;
end;
试了下,没出错啊
 
是不是有类似这种:inttostr,floattostr把fields转成float呀,谢谢!
 
刚才仔细看了一下楼主的原题,楼主实在是高啊。
我不知道楼主干吗要用Recordset属性,难道楼主是从VB转来的?
使用Recordset属性时,应该这样用:
ADOTable1.Recordset.Fields[j].Value
否则,就应该向楼上的那样,直接使用ADOTable的属性。
 
非常感谢两位,分不多,见谅哦!
 
我可以加你们为好友吗,我的QQ330930343
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
861
import
I
I
回复
0
查看
781
import
I
后退
顶部