轉:RTC搭建android下三層應用程式訪問伺服器MsSql-伺服器端

來源:互聯網
上載者:User

標籤:

原文:http://www.cnblogs.com/delphi007/p/3346061.html

前幾天通過Ro搭建webservice,然後在android下調用,雖然已近成功,但是返回的資料庫裡的中文有亂碼一直未得到解決!
rtc6.23版本,已經支援xe5,也支援fmx的android下開發,不多說,需要的請聯絡購買!

一、建立服務端程式:

     1依照官方的demo,建立程式,並添加datamoudel,添加rtc相關服務端控制項TRtcHttpServer,TRtcServerModule,TRtcFunctionGroup,TRtcFunction(2個),2個adoquery,一個adoconnection

   2,設定控制項屬性:

      設定TRtcHttpServer 的ip,連接埠

      設定TRtcServerModule的functiongropu屬性,moudelname,server等

      設定2個TRtcFunction的gropu屬性為TRtcFunctionGroup,並將一個functionname設定為select,另外一個設定為up(一個擷取資料,   一    個更新資料)

    設定ado屬性(略)

    3,編寫代碼

      select的function

procedure TDataModule3.rtcfnctn1Execute(Sender: TRtcConnection; Param: TRtcFunctionInfo; Result: TRtcValue);begin
qry1.Close;
qry1.Open;
DelphiDataSetToRtc(qry1,Result.NewDataSet);//返回result為rtc的dataset
qry1.Close;
end;

up的function

procedure TDataModule3.rtcfnctn2Execute(Sender: TRtcConnection; Param: TRtcFunctionInfo; Result: TRtcValue);
begin
with qry2 do begin
  Close;
  SQL.Text:=‘‘;
  SQL.Text:=‘update 連絡人 set 名字=:a, 生日=:b, 年齡=:c  where 連絡人ID=:d‘;
  Parameters.ParamByName(‘a‘).Value:=Param.asString[‘a‘];
  Parameters.ParamByName(‘b‘).Value:=Param.asDateTime[‘b‘];
  Parameters.ParamByName(‘c‘).Value:=Param.asInteger[‘c‘];
  Parameters.ParamByName(‘d‘).Value:=Param.asInteger[‘d‘];
   ExecSQL;
  Result.asInteger:=ExecSQL;//傳回值為影響的行數
end;
end;

 

服務端其他代碼見demo,運行後請點擊按鈕啟動監聽

 

http://pan.baidu.com/s/1cea38

 

轉:RTC搭建android下三層應用程式訪問伺服器MsSql-伺服器端

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.