procedure TfrmMain.btnSearchClick(Sender: TObject); var i,r,iCount: Integer; ias01: IAndriondServices; S: String; begin ias01 := GetIAndriondServices(True,'http://192.168.1.105:8080/wsdl/IAndriondServices',nil); S := ias01.GetData('SELECT CODE,NAME,SEX,BIRTHDAY,DEPARTNAME FROM EMPPDI');//此处数据为正确的,没有乱码 ShowMessage(S); //测试没有乱码 cds01.XMLData := S; //赋值完以后就乱码了 S := cds01.XMLData; ShowMessage(S); //测试出现乱码
with cds01 do begin iCount := RecordCount; if iCount = 0 then Exit; r := 0; for i := 0 to iCount - 1 do begin sg01.Cells[0,r] := FieldByName('CODE').AsWideString; sg01.Cells[1,r] := FieldByName('NAME').AsWideString; sg01.Cells[2,r] := FieldByName('SEX').AsWideString; sg01.Cells[3,r] := FieldByName('BIRTHDAY').AsWideString; sg01.Cells[4,r] := FieldByName('DEPARTNAME').AsWideString; Inc(r); Next; end; end; end;