var
    S:  String;
    WS: WideString;
begin
    S:='123445';
    WS:=    S;
    Showmessage(WS);
end;

解决方案 »

  1.   

    begin
      S := '是吗?';
      ShowMessage(WideStringt(S)[1]);
    end;
      

  2.   

    我用在手机短信中的,
    详见
    http://www.csdn.net/expert/topic/879/879633.xml?temp=.9558527function GB2UniCode(GB:string):string;
    var
      s: string;
      i, j, k: integer;
      a: array [1..160] of char;
    begin
      s:='';
      StringToWideChar(GB, @(a[1]), 500);
      i:=1;
      while ((a[i]<>#0) or (a[i+1]<>#0)) do begin
        j:=Integer(a[i]);
        k:=Integer(a[i+1]);
        s:=s+Copy(Format('%X ',[k*$100+j+$10000]) ,2,4);
        //S := S + Char(k)+Char(j);
        i:=i+2;
      end;
      Result:=s;
    end;
    function UniCode2GB(S : String):String;
    Var I: Integer;
    begin
       I :=  Length(S);
       while I >=4  do begin
         try
           Result :=WideChar(StrToInt('$'+S[I-3]+S[I-2]+S[I-1]+S[I]))+ Result;
         except end;
         I := I - 4;
       end;
    end;
      

  3.   

    当然需要转了有的地方需要用widestring类型的参数,
    但是我们有edit输入的都是string 类型的数据比如说 我用adoconnection连接数据库时要是在程序运行时改变服务器的名字,和数据库,这时adoconnection的connectionstring需要的是widestring类型的数据,但是我用edit输入的参数都是string 类型的
    两个类型的数据加到一起是根本连不上的数据库的
    谁知道怎么办
      

  4.   

    我的问题是这样的
    我用adoconnection连接数据库时
    需要在程序运行时改变数据库服务器的名称,其实也就是把adoconnection.connectionstring中的一个参数改成变量人为的输入
    但是我用edit输入的数据都是string类型的数据
    这两种数据连在一起的使用就不能连到数据库上了