Original: http://www.cnblogs.com/delphi007/p/3346061.html
A few days ago through the RO build WebService, and then cut in Android, although it has been nearly successful, but the return of the database of Chinese has been garbled has not been resolved!
rtc6.23 version, already support Xe5, also support FMX Android under development, not much to say, need please contact purchase!
First, create a service-side program:
1 according to the official demo, create the program, add Datamoudel, add the RTC related server-side control Trtchttpserver,trtcservermodule,trtcfunctiongroup,trtcfunction (2), 2 Adoquery, one adoconnection
2, set the control properties:
Set Trtchttpserver IP, port
Set the Functiongropu property of the Trtcservermodule, Moudelname,server, etc.
Set the Gropu property of the 2 trtcfunction to Trtcfunctiongroup and set one functionname to select and the other to up (one to get data, one to update data)
Set ADO properties (slightly)
3, writing code
function of Select
Procedure Tdatamodule3.rtcfnctn1execute (sender:trtcconnection; Param:trtcfunctioninfo; Result:trtcvalue); begin
Qry1. Close;
Qry1. Open;
DELPHIDATASETTORTC (Qry1,result.newdataset);//Returns a DataSet with a Result of RTC
Qry1. Close;
End
The function of up
Procedure Tdatamodule3.rtcfnctn2execute (sender:trtcconnection; Param:trtcfunctioninfo; Result:trtcvalue);
Begin
With Qry2 do begin
Close;
Sql. Text:= ";
Sql. text:= ' Update contact set name =:a, Birthday =:b, age =:c where contact 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;//return value is the number of rows affected
End
End
Service side other code see demo, after running please click the button to start monitoring
Http://pan.baidu.com/s/1cea38
Turn: RTC builds Android under three-tier application access server mssql-server side