Hi; I tried using this switch (Ver 11) and not getting the desired results...
DBQuery>dbh,SQL,rsRecordset,numrecs,numfields,1
...
WriteLn>filename,result,rsRecordset_%r%_%f%
I get the following:
17;rsRecordset_1_2;rsRecordset_1_3;rsRecordset_1_4;rsRecordset_1_5...
This is really strange as I get the # 17 at the start and have no idea where this is coming from...
Any help would be appreciated
Thanks
Using dbquery (Optionally set fieldnames to 1)
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 15
- Joined: Wed Dec 19, 2007 9:16 pm
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Looks like you are asking it to return field names but then trying to output based on numbers:
Step past the DBQuery line in the debugger and look in the watch list. You should see variables like:
rsRecordset_1_NAME
etc
Instead of a number at the end you'll see the field name.
Clearly you can't then output using a variable with a number since no such var exists.
What's f?WriteLn>filename,result,rsRecordset_%r%_%f%
Step past the DBQuery line in the debugger and look in the watch list. You should see variables like:
rsRecordset_1_NAME
etc
Instead of a number at the end you'll see the field name.
Clearly you can't then output using a variable with a number since no such var exists.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 15
- Joined: Wed Dec 19, 2007 9:16 pm
Marcus; I'm trying to get the field names as in a header row as in...
[code]
SRT>PrintHeader
Let>r=0
Repeat>r
Let>r=r+1
Let>f=0
Repeat>f
Let>f=f+1
Length>rsRecordset_%r%_%f%,vlen
if>f=1
Let>WLN_NOCRLF=1
If>vlen=0
WriteLn>filename,NULL
ELSE
WriteLn>filename,result,rsRecordset_%r%_%f%
ENDIF
WriteLn>filename,result,;
ELSE
If>vlen=0
WriteLn>filename,NULL
ELSE
WriteLn>filename,result,rsRecordset_%r%_%f%
ENDIF
if>ffilename,result,;
ENDIF
ENDIF
Until>f=numfields
WriteLn>filename,result,CRLF
Until>r=1
Let>WLN_NOCRLF=0
END>PrintHeader
[/code]
[code]
SRT>PrintHeader
Let>r=0
Repeat>r
Let>r=r+1
Let>f=0
Repeat>f
Let>f=f+1
Length>rsRecordset_%r%_%f%,vlen
if>f=1
Let>WLN_NOCRLF=1
If>vlen=0
WriteLn>filename,NULL
ELSE
WriteLn>filename,result,rsRecordset_%r%_%f%
ENDIF
WriteLn>filename,result,;
ELSE
If>vlen=0
WriteLn>filename,NULL
ELSE
WriteLn>filename,result,rsRecordset_%r%_%f%
ENDIF
if>ffilename,result,;
ENDIF
ENDIF
Until>f=numfields
WriteLn>filename,result,CRLF
Until>r=1
Let>WLN_NOCRLF=0
END>PrintHeader
[/code]
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
That makes no sense - your loop is referring to the fields numerically but you are asking it to return the names.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 15
- Joined: Wed Dec 19, 2007 9:16 pm
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
The idea is that you already know the field names and you use them to reference the array.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?