You are not logged in.
Pages: 1
Hi, I am a newbie and I could need some help.
I would like to transfer data over the internet into identical MSSQL tables.
I can easily get data from the server like this:
...
aModel := DataModel;
aClient := TSQLHttpClientWinHTTP.Create(SERVER,SERVER_PORT,aModel);
AMyTable := TMyTable.CreateAndFillPrepare(aClient,'ID>0');
while AMyTable.FillOne do
begin
Memo1.Lines.Add( AMyTable.MyDataField );
end;
AMyTable.Free;
aClient.Free;
aModel.Free;
...
Now I would like to store the data on my Server.
My first thought was the "oldfashioned" way:
...while AMyTable.FillOne do
begin
MyAdoQuery.SQL.Add('INSERT MyTable (MyDataField) Values( ' + AMyTable.MyDataField + ')')
end;
MyAdoQuery.ExecSQL;
My second thought:
mORMot is such a great piece of software architecture, they probably have impelemented this task in a much more elegant way.
Thank you for any hints /examples.
Offline
Yes, thank you, the "just use ..." suggests a quick and easy implementation.
I aleady found
AClient.Add()
and even better
AClient.BatchStart(TPerson);
AClient.BatchAdd(APerson,true);
AClient.BatchSend(Res);
I only found TSQLRestClient and TSQLRestServer, but I need to store the data in my local MSSQL Database.
So my question is:
- Should I use TSQLRestClientDB? And how do I connect ?
Offline
Create a 2nd TSQLRestServerDB/TSQLRestClientDB, then register the local MSSQL database, and BatchAdd() on this one.
But I do not understand your design?
Which not directly connect from the client to the server, via HTTP, and use the local MSSQL database as storage on the server side?
Offline
Of course I am open for any better solution.
Is there any example for " directly connect from the client to the server, via HTTP, and use the local MSSQL database as storage on the server side" ?
Thank you very much!
Offline
Please take a look at sample "28 - Simple RESTful ORM Server".
It is for PostgreSQL, but you just have one line to change so that it would use MSSQL.
Take a look at the documentation and the samples supplied.
Especially http://synopse.info/files/html/Synopse% … ml#TITL_27
Offline
Pages: 1