相同的数据库结构,在SQL SERVER2000中一切正常,可是到ACCESS出现问题:
错误信息:
project project1.exe raised exception class EVariantTypeCastError with message 'Could not convert variant of type(NULL) into type(String)'.process stopped但是可以建立工程,.EXE文件运行也没什么问题,请问这是为什么,程序比较长,不方便贴出源码

解决方案 »

  1.   

    'Could not convert variant of type(NULL) into type(String)'
    这是错误提示,你看看你的程序中是否有类似的赋值处理呢?
    var
      s:string;
    s:=adoquery1.fieldbyname('Fieldname').value;{variant----->string}//---隐式转换
    改成这样的:
    s:=trim(adoquery1.fieldbyname('fieldname').asstring);//---显式转换
      

  2.   

    在数据库中type(NULL)空值的转换问题.试着改为0应该不会出现这样了.
      

  3.   

    if AdoQuery1.FieldByName('aFieldName').Value <> NULL then
    begin
      //可以赋值
    end else
    begin
      //不能赋值,需要另想办法
    end;
      

  4.   

    sql server里面的char字段吧二楼正解
      

  5.   

    if adoquery.field['name'].isnull  then
    //you can't 
    else
    //you can
      

  6.   

    if adoquery.field['name'].isnull  then
    //you can't 
    else
    //you can