请问这2种变量类型 的区别和在三层应用中,这个2个变量用法。谢谢。

解决方案 »

  1.   

    一般不建议使用Variant和OleVariant,除非数据类型只有在运行期才能确定或获知的。OleVariant常常用来做基于COM的程序:Auutomation和ActiveX控制,Variant基于non-COM的程序
      

  2.   

    区别是一个多了Ole,一个少了Ole,xixi...我也不知道,听课
      

  3.   

    The OleVariant type exists on both the Windows and Linux platforms. The main difference between Variant and OleVariant is that Variant can contain data types that only the current application knows what to do with. OleVariant can only contain the data types defined as compatible with OLE Automation which means that the data types that can be passed between programs or across the network without worrying about whether the other end will know how to handle the data.When you assign a Variant that contains custom data (such as a Delphi string, or a one of the new custom variant types) to an OleVariant, the runtime library tries to convert the Variant into one of the OleVariant standard data types (such as a Delphi string converts to an OLE BSTR string). For example, if a variant containing an AnsiString is assigned to an OleVariant, the AnsiString becomes a WideString. The same is true when passing a Variant to an OleVariant function parameter.在delphi的帮助中都有这些说明的 阿
      

  4.   

    olevariant存在于windows和linux平台,这二种类型主要的不同是variant类型仅是当前的应用程序可以进行操作,而olevariant类型则是ole自动化服务器所以定义的统一的数据类型,意味着可以通过网络或其他程序进行操作,当然也不必担心其他客户端如何进行操作.当你给一个variant类型的变量赋自定义的值的时候(例如delphi string,或一个其他的新的自定义类型),运行时间库将试着将他转化为olevariant标准数据类型(例如string转化为 OLE BSTR string),例如,一个包括Ansistring数据的variant类型斌值给olevariant,ansiString将成为WideString,当把variant传为olevariant的函数参数也是一样的.
      

  5.   

    var 
      i : integer;
      j : varian;
      s : string;
      ss: string;
    begin
      i:=1;
      j:=i;//是整形
      s:='sdfsdf';
      ss:=s;//是string形
    end;
      

  6.   

    错了,是这样的
    var 
      i : integer;
      j : varian;
      s : string;
      ss: varian;
    begin
      i:=1;
      j:=i;//是整形
      s:='sdfsdf';
      ss:=s;//是string形
    end;