# Gridtablebase with sql

**URL:** <https://www.ruby-forum.com/t/gridtablebase-with-sql/185145>\
**Category:** wxRuby\
**Created:** [March 15, 2010, 5:54am UTC](https://www.ruby-forum.com/t/gridtablebase-with-sql/185145 "2010-03-15T05:54:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hendra\_kusuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@hendra\_kusuma](https://www.ruby-forum.com/u/hendra_kusuma)\
**Post date:** [March 15, 2010, 5:54am UTC](https://www.ruby-forum.com/t/gridtablebase-with-sql/185145/1 "2010-03-15T05:54:59Z")

</div>

Dear all

How do I use gridtablebase to display record I get from sql?

I try to follow the help and sample,  
but I don’t understand how to combine the sql data

sample code would be good

Thank you  
Regards  
Hendra

---

<div class="post-metadata">

**Author:** ![hendra\_kusuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@hendra\_kusuma](https://www.ruby-forum.com/u/hendra_kusuma)\
**Post date:** [March 15, 2010, 7:35am UTC](https://www.ruby-forum.com/t/gridtablebase-with-sql/185145/2 "2010-03-15T07:35:37Z")

</div>

Hi Hendra

On 15/03/2010 04:53, hendra kusuma wrote:

> How do I use gridtablebase to display record I get from sql?
> 
> I try to follow the help and sample,  
> but I don’t understand how to combine the sql data
> 
> sample code would be good

Someone else may have some code to offer, but I’m afraid most people  
don’t have time to write a complete code sample. Your class should  
inherit from Wx::GridTableBase and there’s a set of method that your  
class must provide to provide the SQL results to the table.The  
documentation is there; the sample has some comments and can be used as  
a template. It’s probably worth looking at it again, understanding what  
each method is doing, then having a go yourself. If you get stuck on  
something specific, I’d be happy to help.

best  
alex

---

<div class="post-metadata">

**Author:** ![hendra\_kusuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@hendra\_kusuma](https://www.ruby-forum.com/u/hendra_kusuma)\
**Post date:** [March 15, 2010, 8:43am UTC](https://www.ruby-forum.com/t/gridtablebase-with-sql/185145/3 "2010-03-15T08:43:30Z")

</div>

On Mon, Mar 15, 2010 at 1:35 PM, Alex F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > sample code would be good  
> > best  
> > alex

Thank you Alex, you are always helpful  
I finally figure it out  
so to put it simpy, all I need is 2 dimension array of my sql result  
and put it in  
def get\_value(row, col)  
(sql\_result[row])[col].to\_s  
end

I found that each time i modify sql result  
I need to recreate the object  
to avoid error caused by difference in row number

well, thats enough for the time being 🙂

Thank you  
Regard  
Hendra
