我用ADOConnection连接一个数据库,然后用ADOTable关联一个数据表,
结果程序一运行就报“”的错误,该怎么改?Project test.exe raised exception class EVariantTypeCaseError with message
'Could not convert variant of type (Null) into type (String)'. Process
stopped.......

解决方案 »

  1.   

    数据类型不匹配,检查一下你的表,或转换为variant ,String
      

  2.   

    很简单的一个Access数据库,
    里面有一个数据表,没有什么blob字段,
    我是用ODBC的别名MYODBC数据库访问的,但就是访问不了啊。
      

  3.   

    78hgdong(赤脚) : 这个带星星的你自己试一下用一个ODBC数据源,用ADOConnection来试一下。
      

  4.   

    http://community.csdn.net/Expert/topic/4992/4992514.xml?temp=.6489527
    ----------------------那个问题估计是由于ADOTable控件内部的bug引起,即使你用try{}catch(...)
    也是捕捉不到那个异常的,
    解决方法就是用ADOQuery替代ADOTable,其实ADOTable无非就是ADOQuery的一个特例吧,因为ADOTable就相当于ADOQuery的sql语句为: select * from Tbl1.
      ADOConnection1->Connected = false;
      ADOConnection1->ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=TESTDB";
      ADOConnection1->Connected = true;
      ADOQuery1->Close();
      ADOQuery1->Connection = ADOConnection1;
      ADOQuery1->SQL->Clear();
      ADOQuery1->SQL->Add("select * from " + Edit1->Text);
      ADOQuery1->Open();