Your webservice
connects to your database and you use a SQLconnection
, one SQLDataset
and a Datasetprovider
. In the Commandtext
of your sqldataset
you inserted something like
Select * from tabela where id =:id
In your mobile application, in your datamodule you put SQLConnection
, datasnap drive, a DSProviderconnection
and still a ClientDataSet
, in the inspector Object of the ClientDataSet
you set the RemoteServer
for your DSProviderConnection
and in the ProviderName
set your datasetprovider
there of your webservice
.
In Params you create a new parameter with the name of id
, give a value 1 for it just to test, right-click on your clientdataset
and click on FieldsEditor
, right click on the white area of the new window and click on Add Fields
, If you load all fields of the table it is a sign that everything is ok by passing the correct parameter, delete the value of the parameter created in your clientdataset
.
When you need to make a request using parameter just use:
ParamByName('id').AsInteger := 1;
To save the changed data that was loaded is that old story of Post
and ApplyUpDates()
I hope you’ve been helpful
try to pass as parameter in your method
– Passella
But I create the method with parameters on the server, so how do I receive these parameters on the mobile? type, have to appear the data in each field on mobile and the user will change this data, save and send back to Mysql database. I don’t know how to do it right
– Léia
Do one method on the server to return a Tdataset and another to Receive a Tdataset. Ex.: Getclientes(): Tdataset and other Setclientes(dtsDados: Tdataset);
– Passella