WTA - How To Convert IZResultSet to TDataSet?

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
NiksenH
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 02.02.2012, 12:15

WTA - How To Convert IZResultSet to TDataSet?

Post by NiksenH »

Hi there...
is there any one knows how to convert object from class IZResultSet to TDataSet descendant? :roll: Iwant to display it with TDBGrid.

I'm using Lazarus, ZEOS 6.6.6, and MySQL5.5.
In my database I have stored procedure that returns multiple resultsets. I found an example used of ZEOS for calling this stored procedure. It uses IZResultSet for storing those resultsets. But in that example, we just can calling each field and put them into a TLabel or TEdit. Now I want to display them in TDBGrid.

A member in other forum told me that it could be done (but not tell me how) :( . What i was thinking is copying each row and each field into TDataset descendant using loop (FOR or WHILE). But this is silly :lol:


*sorry for my bad English
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Why are you using IZResultset instead of just using a TZQuery which IS a TDataset descendant??
If you have a reason to do this, that's alright for me. Then you can check the code in the components source directory of zeoslib to see how the conversion is done there.

Mark
Image
NiksenH
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 02.02.2012, 12:15

Post by NiksenH »

hi mdaems...
i've described it in above...

"In my database (MsSQL & MySQL) I have stored procedure that returns multiple resultsets. I found an example used of ZEOS for calling this stored procedure. It uses IZResultSet for storing those resultsets. But in that example, we just can calling each field and put them into a TLabel or TEdit. Now I want to display them in TDBGrid."

and the solution was writen by your self.
http://zeos.firmos.at/viewtopic.php?t=1141
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

NiksenH,
Sorry for not reading your question good enough. Indeed, I remember the post you refer to.

I see two possible solutions.
- Write a TZAbstractRODataset method OpenFromIZResultset. When you publish that for the TZReadOnlyQuery that may work fine.
- Make a component/class similar to ZSQLMetadata. That's a component that shows data that does not originate from sql queries (at least : not directly)

Mark
Image
Post Reply