数据读取错误
我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;