数据读取错误

qlonsh qlonsh 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我TADOQUERY(ADOQueChA)组件读取数据库时,当有个记录值为空时,出现提示错误,说不把把空值转换为字符,请问怎么解决这个问题啊
procedure TFrmNumeralTV.ShowChanNum; ////窗体显示时,频道分类标题同步显示
var
i:integer;
str1,str2:string;
begin
for i:=1 to 8 do
begin
With ADOQueCha do
begin
close;
SQL.Clear;
SQL.Add('select ParentKind from Chanel where ParentKindID=:ID');
parameters.ParamByName('ID').Value:=i;
open;

STR1:=LEFTSTR(ADOQueChA.FieldValues['ParentKind'],3); //出现错误提示:不能把NULL转换为字符(STRING)
Case i of
1: LabTitle1.Caption:=STR1;
2: LabTitle2.Caption:=STR1;
3: LabTitle3.Caption:=STR1;
4: LabTitle4.Caption:=STR1;
5: LabTitle5.Caption:=STR1;
6: LabTitle6.Caption:=STR1;
7: LabTitle7.Caption:=STR1;
8: LabTitle8.Caption:=STR1;
end;
STR2:=ADOQueChA.FieldValues['ParentKind']; //显示完整的标题
Case i of
1: LabTitle1.Hint:=STR2;
2: LabTitle2.Hint:=STR2;
3: LabTitle3.Hint:=STR2;
4: LabTitle4.Hint:=STR2;
5: LabTitle5.Hint:=STR2;
6: LabTitle6.Hint:=STR2;
7: LabTitle7.Hint:=STR2;
8: LabTitle8.Hint:=STR2;
end;
end;
end;

end;
...全文
评论 5
收藏 已收藏
分享
返回顶部
qlonsh
Delphi 5,944 成员 262,941 内容