AutoHotkey Community

It is currently May 27th, 2012, 6:51 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: September 12th, 2011, 3:42 am 
Offline

Joined: February 11th, 2007, 4:10 pm
Posts: 185
I want to query info from database via ADO. GetRows, a method of recordset, returns a 2D safearray, but I have no idea about it. How to get data from a safearray easily? Or I SHOULD be more wise to use GetString method instead?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2011, 3:57 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
What version of AutoHotkey are you using? I'd recommend AutoHotkey_L if you're not - and to make sure you're using the Native Com Support. (see ComObjArray)

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2011, 5:10 am 
Offline

Joined: February 11th, 2007, 4:10 pm
Posts: 185
jethrow wrote:
What version of AutoHotkey are you using? I'd recommend AutoHotkey_L if you're not - and to make sure you're using the Native Com Support. (see ComObjArray)


Yes, I use native com of AHK_Lw.
Code:
sa := recordset.GetRows() ; return 2D safearray, col/row, base 0
if ComObjType(sa) & 0x2000
   msgbox % sa[1][1] . A_TAB . sa[0][0]

I am sure the recordset is not empty, but the array syntax seems not to suit for safearray, it always return null.
NEED I create a safearray manually before call GetRows? Then I should get the num of cols and rows first, but sometimes it is not sure.


Last edited by hughman on September 12th, 2011, 5:17 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2011, 5:13 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
I believe you have to use this:

Code:
sa := recordset.GetRows() ; return 2D safearray, col/row, base 0
if ComObjType(sa) & 0x2000
   msgbox % sa[1,1] . A_TAB . sa[0,0]

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2011, 3:15 pm 
Offline

Joined: February 11th, 2007, 4:10 pm
Posts: 185
sinkfaze wrote:
I believe you have to use this:


Thanks. You're right.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, migz99, sjc1000, Yahoo [Bot] and 64 guests


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

Search for:
Powered by phpBB® Forum Software © phpBB Group