Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to use SQLConnection.Execute onto DataSnap Server?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Adriano Santos

Posts: 55
Registered: 5/17/07
How to use SQLConnection.Execute onto DataSnap Server?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 9, 2014 11:52 AM
Hi,

I'm creating a tool for import data from DBF to SQLServer using DataSnap;
In my client side I created a routine for send a SQL instruction and Params (TParams). For exemplo:

procedure Import;
var
  Params : TParams;
  _sql : String;
begin
 
  Params := TParams.Create(Self);
  Params.CreateParam(ftString, 'Param1', ptInput).Value := 'Adriano';
  Params.CreateParam(ftString, 'Param2', ptInput).Value := 'Santos';
  
  _sql := 'INSERT INTO TABLE (FIELD1, FIELD2) VALUES (:PARAM1, :PARAM2)';
 
  //Call server method
  MyProxy.ExecuteImport(_sql, Params);
end;


//Server Method
function ExecuteImport(AInstruction: string; AParams: TParams);
begin
  try
    SQLConnection.Execute(AInstrunction, AParams);
  except
    raise Exception.Create(E.Message);
  end;
end;

So, on server I have a Server Method.

In first time the method is executed, but the second time I receive a "Access Violation" error.
--
Embarcadero MVP - Brazil
http://www.tdevrocks.com.br

Edited by: Adriano Santos on Jun 9, 2014 11:52 AM

Edited by: Adriano Santos on Jun 9, 2014 11:53 AM

Edited by: Adriano Santos on Jun 9, 2014 11:54 AM

Edited by: Adriano Santos on Jun 9, 2014 11:55 AM

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02