How to access server functions in datasanp

Source: Internet
Author: User

Server:

1. Create a datasanp server.

2. Add, sqlconnettion, clientdataset, and datasetprovider. set parameters.

 

 

3. create function recordcount (SQL: string) in servermethodsunit1: integer;

Function tservermethods1.recordcount (SQL: string): integer;
Begin
If studenttable. Active then
Studenttable. close;
Studenttable. commandtext: = SQL;
Studenttable. open;
Result: = studenttable. recordcount;

End;

Client:

Put an edit control. And sqlconnettion, clientdataset, and dsproviderconnection respectively.

 

Type
Tform1 = Class (tform)
Button1: tbutton;
Btn1: tbutton;
Sqlconnection1: tsqlconnection;
Clientdataset1: tclientdataset;
Dsproviderconnection1: tdsproviderconnection;
Clientdataset1id: tintegerfield;
Clientdataset1name: tstringfield;
Clientdataset1shuxue: tfmtbcdfield;
Clientdataset1yuwen: tfmtbcdfield;
Edt1: tedit;
Procedure button1click (Sender: tobject );
Procedure formcreate (Sender: tobject );
Procedure btn1click (Sender: tobject );

Private
Fservermethods1client: tservermethods1client; // defines an attribute to obtain the tservermethods1client
Function getservermethods1client: tservermethods1client; // read of fservermethods1client
{Private Declarations}
Public
Property servermethods1client: tservermethods1client read getservermethods1client write fservermethods1client; // publish attributes
{Public declarations}
End;

VaR
Form1: tform1;

Implementation

{$ R *. FMX}
{$ R *. lgxhdpiph. FMX Android}
{$ R *. nmxhdpiph. FMX Android}
{$ R *. smxhdpiph. FMX Android}

Procedure tform1.btn1click (Sender: tobject );
VaR
Servermethod1: tservermethods1client;
Begin
Servermethod1: = servermethods1client;
Edt1.text: = inttostr (servermethod1.recordcount ('select * from student '));
End;

 

This Bolg illustration is too convenient. It is too troublesome to save it and insert it again ..

How to access server functions in datasanp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.