Recent

Author Topic: Component Questions  (Read 2464 times)

Emerson

  • New Member
  • *
  • Posts: 37
Component Questions
« on: July 06, 2020, 08:03:10 pm »
Hello! I'm new to Lazarus and I need help. I need a component that replaces the Delphi ClientDataSet communicating with the Query component and bringing the information to memory, where I can manipulate the records. I also need a good reporting component. Thank you!

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Component Questions
« Reply #1 on: July 06, 2020, 08:28:52 pm »
Lazarus comes with examples.

They are located in the Lazarus folder under Examples/Samples

In those you will find multiple test apps for various items controls

 In any case you are looking for controls that are located on the Data Controls, Data Access and SQLdb tabs
If you already have some source code to go by you can then easily integrate it with laz
The only true wisdom is knowing you know nothing

Emerson

  • New Member
  • *
  • Posts: 37
Re: Component Questions
« Reply #2 on: July 06, 2020, 08:38:27 pm »
I even managed to see the examples, but they have no connection with the ClientDataSet. Only in addition, I was able to connect to the database and display the information, but I need to work with ClientDataSet for the following reason.
My Delphi applications work as follows:
1 - Connects to the database.
2 - Execute and activate the query.
3 - Activate the clientdataset that is linked to the query.
4 - Disable the query.
5 - Disconnect from the database.
Doing these procedures, the data is stored in the clientdataset (memory) where I can manipulate the local information and only then send it to the server.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Component Questions
« Reply #3 on: July 06, 2020, 08:56:23 pm »
I don't think Laz has one exactly that name but if you look at the ACCESS tab you will see the
TBufDataset which is basically what you are talking about..

 Its a in memory dataset but It may only have some of the properties you are are looking for,  most likely enough to get you started.
The only true wisdom is knowing you know nothing

Emerson

  • New Member
  • *
  • Posts: 37
Re: Component Questions
« Reply #4 on: July 06, 2020, 09:01:53 pm »
I found it and did tests, however, it doesn't connect to the query to load the data into memory. This is a big problem I'm having.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Component Questions
« Reply #5 on: July 06, 2020, 09:16:52 pm »
and what query component did you try ?

The components here are not fully loaded per component like it would be in Delphi, you need to place a few items on the form and connect them which is why I said it may not have all the properties..

 For Example the TSQLQuery will accept a DataSource which is accept the bufDataSet

of course with the SQLQuery you need to put in a Database component so you can then connect to the server.

 Its a trickle down effect.

 I am not a database coder because I dislike it very much but in the last few post I have given you it feels like I am becoming an expert in a very short time (Crash Corse)..
 Or the School of Underwood databases, use to be a punt but now it looks like it actually official …
The only true wisdom is knowing you know nothing

Emerson

  • New Member
  • *
  • Posts: 37
Re: Component Questions
« Reply #6 on: July 06, 2020, 09:29:48 pm »
I am testing the components of zeoslib. In Delphi I do the following:
1 - Connection connected to the database
2 - Query connected to the connection
3 - DataSetProvider linked to the query
4 - ClientDataSet connected to the provider
5 - DataSource linked to clientdataset
When I need to search for a record I do the following:
1 - Connect to the database.
2 - Inform the SQL for the query and active object
3 - Activate the clientdataset
4 - Disable the query
5 - I disconnect the database.
With these procedures, I can have a desktop system that works with any database provider, even the slow ones in the market because I don't keep a constant connection.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Component Questions
« Reply #7 on: July 06, 2020, 09:35:29 pm »
Its in there, just keep at it, I need to go play some tennis now...

Enjoy..
The only true wisdom is knowing you know nothing

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: Component Questions
« Reply #8 on: July 06, 2020, 09:40:43 pm »
I found it and did tests, however, it doesn't connect to the query to load the data into memory. This is a big problem I'm having.

TBufDataset.CopyFromDataset
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

Emerson

  • New Member
  • *
  • Posts: 37
Re: Component Questions
« Reply #9 on: July 06, 2020, 09:55:37 pm »
I still haven't found the solution.

iret

  • New Member
  • *
  • Posts: 15
Re: Component Questions
« Reply #10 on: October 26, 2020, 10:18:35 am »
Hi emersonldc,

I'm looking for a similar solution, did you make progress with your project?


Best reagrds

egsuh

  • Hero Member
  • *****
  • Posts: 1273
Re: Component Questions
« Reply #11 on: October 31, 2020, 02:55:58 am »
As Dsiders told, put an TBufDataSet, and when DB is connected, open your query (let's say query1) first, and copy it to TBufDataSet. 

    Query1.Open;
    BufDataSet1.CopyFromDataSet(Query1);
    BufDataSet1.Open;
    Query1.Close;

Then you can do anything on the BufDataSet. You may link a datasource to the BufDataSet1 and DB controls to the datasource.

iret

  • New Member
  • *
  • Posts: 15
Re: Component Questions
« Reply #12 on: November 05, 2020, 05:11:23 pm »
Thanks for your answer,

I'm aware of this but what about changes to BufDataSet1? Is there a simple way to Apply these changes to the database?
Of course I could look for changes, build SQL statements and use "XYZConnection.ExecuteDirect" to save the data, but
obviously it's not as nice as using SQLDb's capabilities for constructing SQL.





bpranoto

  • Full Member
  • ***
  • Posts: 134
Re: Component Questions
« Reply #13 on: November 05, 2020, 06:23:58 pm »
I use kbmMemTable.

It can load a record from any Dataset, and has a mechanism to apply the changes via a DeltaHandler.

However, it's a commercial and not a free product.

Check http://www.components4developers.com/products_kbmMemTable.html


 

TinyPortal © 2005-2018