Page 1 of 1

WTA - How To Convert IZResultSet to TDataSet?

Posted: 02.02.2012, 12:25
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

Posted: 01.03.2012, 01:03
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

Posted: 01.03.2012, 06:11
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

Posted: 14.03.2012, 23:21
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