Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Jul 27, 2017 9:20 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Changing values of vars passed as a paramarray
PostPosted: Wed Mar 06, 2013 4:39 am 
Offline

Joined: Wed Mar 06, 2013 4:25 am
Posts: 4
Hello to all of you. I'm new in the Real Software community, and still learning how to get the best of it.

While reading about databases and recordsets, I've written a Method quite similar to this:

Method SQLExec (SQL as string, paramarray a as variant)

SQL is select sentence, something like "select person_id, first_name, secon_name from persons where person_id = '01'"

The purpose of this method is to assign the values of the fields to a number of variables. Because the select sentence passed as the SQL parameter can retrieve any number of fields, I thought I could include these variables as a paramarray.

The problem is that "Paramarray" and "ByRef" cannot be used together, so no matter what happens inside this method, outside its scope, this vars keep its original values.

Have any of you had tried something similar, and has found a workable workaround? Any kind of help will be much appreciated.

Thank you very much


Top
 Profile  
Reply with quote  
 Post subject: Re: Changing values of vars passed as a paramarray
PostPosted: Wed Mar 06, 2013 5:29 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Use a dictionary instead. It can hold name/value pairs. Populate the dictionary (or array of dictionaries if you want the entire result set) and return it from the function.


Top
 Profile  
Reply with quote  
 Post subject: Re: Changing values of vars passed as a paramarray
PostPosted: Thu Mar 07, 2013 2:54 am 
Offline

Joined: Wed Mar 06, 2013 4:25 am
Posts: 4
Not exactly what I had in mind, but it will do just fine. I also got to know the dictionary class because of your reply.

Thank you very much, timhare.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group