RTC搭建android下三层应用程序访问服务器MsSql-服务器端

 

前几天通过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

前几天通过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