一个有意思的数据库问题 类型出错,不匹配,adoquery.fieldbyname('x').asstring of 或者用adoquery.fieldbyname('x').asinteger of 试试 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 首先应该了解x的取值。如果是整数请将它赋给整数变量(如 i:integer),如果是字符串,请转化成整数后赋给整数变量(i:integer).然后用case i ... Case语句中的判断变量只能用序数类型(整形,字符,列举,布儿和集合类型等有次序的类型). 同意wolfAone(黑色的狼(WOLF))的说法,嘿嘿! 既然只能是0,1,你直接用asinteger不就结了。 用if .. then ... else语句吧,或者,你首先定义一个集合;不然,CASE...of 不能用 只有两个值:0,1 吧 为何不用 if adoquery.fieldbyname('x').AsInteger=0 then begin //--- end else begin //--- end; 而用Case 呢? 不明? .value是variant型的变量,当然会出错用.asinteger就行了!! 定义一个变量:var i:integer;begin i:=adoquery.fieldbyname('x').value; case i of ... end;{case} end;这样肯定没有问题 改为: case adoquery.fieldbyname('x').AsInteger of case 0:...... case 1:...... end;因为Value是Variant型,而Case需要序数型,所以转成整型就行了 如何在IdHTTP控件中使用Cookie 急急。。。请各位帮忙! 从哪里能获得VCL的源码?谢谢! delphi2010包,每次编译后引用该包的其他包和程序都要重编译么? dbgrid 我的delphi打开后只能显示如下: 如何重画stringgrid标题栏? 动态创建的组件如何检测其事件?? 如何將infopower3000中的文字中文化. delphi自带控件 怎么样把paintbox的图形输出到打印机?? 谁有将图形写入数据库的例子?最好是例子,片断代码俺不太能看明白,呵呵!
语句吧,或者,你首先定义一个集合;
不然,CASE...of 不能用
begin
//---
end
else
begin
//---
end; 而用Case 呢? 不明?
用.asinteger就行了!!
var
i:integer;
begin
i:=adoquery.fieldbyname('x').value;
case i of
...
end;{case}
end;这样肯定没有问题
case adoquery.fieldbyname('x').AsInteger of
case 0:......
case 1:......
end;
因为Value是Variant型,而Case需要序数型,所以转成整型就行了