Now that we have a server available, we can move on and build a first client. In the DataSnap 2009 client application we need to use an SQLConnection component associated with the new DataSnap dbExpress driver, configured with the proper TCP/IP port.
Next we need a DSProviderConnection component, used to refer to the server class, with the ServerClassName property. This is not the intermediary class factory in the server (DSServerClassl), but the actual target of the class factory, in my example the TDSFirst3TierServerModu1e class.
Like in a traditional DataSnap application, the provider can be used by the ClientDataSet component to fetch (and update) the remote dataset. First, you have to assign the RemoteServer property of the ClientDataSet, picking the DSProviderConnectionl component from the drop down list. Next, you can select the DataSetProviderEmployee provider from the drop down of the ProviderName property, populated with all exported DataSetProvider components of the remote data module.
This is a summary of the properties of these components, plus a DataSource used to display the database table in a DBGrid:
object SQLConnectionl: TSQLConnection
DriverName = 'Datasnap' end object DSProviderConnectionl: TDSProviderConnection ServerClassName = 'TDSFirst3TierServerModule' SQLConnection = SQLConnectionl end object ClientDataSetl: TClientDataSet
ProviderName = 'DataSetProviderEmployee' RemoteServer = DSProviderConnectionl end object DataSourcel: TDataSource DataSet = ClientDataSetl
That's all it takes for an introductory demo. Now if you run the server first and the client next, you can press the Open button of the client and see the database data. Also notice the log produced by the server, like in the next screen shot of the combined programs:
Was this article helpful?
What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.