I was basically following this example : http://www.youtube.com/watch?v=B4uxLLIUddg
New -> Other ->Datasnap Server -> VCL Forms Application (All default settings,Port 211 working, TDSServerModule).
Then created a table in SQLite :
CREATE TABLE [T1] (
[ID] INTEGER PRIMARY KEY AUTOINCREMENT,
[DATE] DATE,
[TIME] TIME);
On my ServerMethodsUnit1 I dropped a TSQLConnection. Changed the Driver to Sqlite. Removed LoginPrompt. Connection connected OK. Added TSQLDataset and connected it to my SQLITECONNECTION. Set CommandText to my T1 (the table name). Made it active without a problem. Added a datasetprovider1 and lined it to my dataset (The table T1). Saved all. Run the server without a problem.With the server running,I constructed the client side:
To my project I added a new project (vcl forms application). Added a SQLConnection component. Set its driver name to Datasnap. Removed loginprompt. On the form I dropped DSProviderConnection1. Connected it to my sqlconnection. Set its ServerClassname to TServerMethods1. Tested the connection - both work OK. Dropped a Clientdataset. Connected its RemoteServer property to that of DSProviderConnection1. ProviderName to DataSetProvider1. Connection succeeded. Clientdataset is active. Added a DataSource.Linked it to my Clientdataset. All connections work. So I added a little GUI. Dropped a TDBGrid and a TDBNavigator. Linked them to Datasource1. The first strange thing I noticed is that all fields displayed Widememo. Why is this when fields are completely different,I dont know. Went to the fields editor,added the fields and when checking the BlobType all displayed ftWideMemo.
I tried to insert todays date directly in the grid and somehow in my DB it ended up : 1899-12-30. Checking the table (T! on the server side), the DATE,and TIME field also displays widememo.
What am I missing here ?
SQlite has very loose typing. DATE and TIME are not part of SQLite. And DBGrids don't know what to do with SQLite TEXT.
The way I got around this problem was to use VARCHAR(length) instead of TEXT when defining the fields. Then those will display OK in a DBGrid. And I did dates also as VARCHAR().
See Also
Displaying and editing MEMO fields in Delphi's TDBGrid http://delphi.about.com/library/weekly/aa030105a.htm