469,350 Members | 1,829 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,350 developers. It's quick & easy.

How to declare the result of a loop as a variable?

I'm trying to include a list of people that's the result of looping through
a recordset in a CDONTS mail. I'm trying to Dim the output of a loop, and it
ain't working -- I'm getting a syntax error. Any ideas why the following
snippet isn't working?

<%
Dim ConfirmedSpeakerList2
ConfirmedSpeakerList2=(While ((Repeat1__numRows <> 0) AND (NOT
rsConfirmedSpeakers.EOF))
(rsConfirmedSpeakers.Fields.Item("Per_GivenName"). Value)

Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsConfirmedSpeakers.MoveNext()
Wend)%>

<%Response.Write ConfirmedSpeakerList2%>

I have the feeling I may be about to learn an unfortunate lesson, but...
wait and see.

Are there other ways that I could get looped output embedded in a CDONTS
mail? I thought trying to Dim the output of the recordset as a big long
string would be the cleanest way to make this happen.

Many thanks.
Jul 19 '05 #1
4 1821
I ~think~ this is what you're trying to do.

sResult = ""
Do while Not rsConfirmedSpeakers.EOF and Repeat1_numRows <> 0
sResult = sResult &
rsConfirmedSpeakers.Fields.Item("Per_GivenName").V alue
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsConfirmedSpeakers.MoveNext()

Loop

Response.Write sResult

Ray at work

"Ken Fine" <ke*****@u.washington.edu> wrote in message
news:bk***********@nntp6.u.washington.edu...
I'm trying to include a list of people that's the result of looping through a recordset in a CDONTS mail. I'm trying to Dim the output of a loop, and it ain't working -- I'm getting a syntax error. Any ideas why the following
snippet isn't working?

<%
Dim ConfirmedSpeakerList2
ConfirmedSpeakerList2=(While ((Repeat1__numRows <> 0) AND (NOT
rsConfirmedSpeakers.EOF))
(rsConfirmedSpeakers.Fields.Item("Per_GivenName"). Value)

Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsConfirmedSpeakers.MoveNext()
Wend)%>

<%Response.Write ConfirmedSpeakerList2%>

I have the feeling I may be about to learn an unfortunate lesson, but...
wait and see.

Are there other ways that I could get looped output embedded in a CDONTS
mail? I thought trying to Dim the output of the recordset as a big long
string would be the cleanest way to make this happen.

Many thanks.

Jul 19 '05 #2
Thanks for the help. Unfortunately, this code is returning nothing into the
var sResult, when I know there is content to be had in the recordset. Can
you think of any obvious error in the code which might be blanking out the
variable?
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:e8**************@TK2MSFTNGP09.phx.gbl...
I ~think~ this is what you're trying to do.

sResult = ""
Do while Not rsConfirmedSpeakers.EOF and Repeat1_numRows <> 0
sResult = sResult &
rsConfirmedSpeakers.Fields.Item("Per_GivenName").V alue
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsConfirmedSpeakers.MoveNext()

Loop

Response.Write sResult

Ray at work

"Ken Fine" <ke*****@u.washington.edu> wrote in message
news:bk***********@nntp6.u.washington.edu...
I'm trying to include a list of people that's the result of looping through
a recordset in a CDONTS mail. I'm trying to Dim the output of a loop,

and it
ain't working -- I'm getting a syntax error. Any ideas why the following
snippet isn't working?

<%
Dim ConfirmedSpeakerList2
ConfirmedSpeakerList2=(While ((Repeat1__numRows <> 0) AND (NOT
rsConfirmedSpeakers.EOF))
(rsConfirmedSpeakers.Fields.Item("Per_GivenName"). Value)

Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsConfirmedSpeakers.MoveNext()
Wend)%>

<%Response.Write ConfirmedSpeakerList2%>

I have the feeling I may be about to learn an unfortunate lesson, but...
wait and see.

Are there other ways that I could get looped output embedded in a CDONTS
mail? I thought trying to Dim the output of the recordset as a big long
string would be the cleanest way to make this happen.

Many thanks.


Jul 19 '05 #3
The lesson to be learned is that a loop does not return a result. A loop is
just a flow. Is your loop even being entered? Are your conditions true?
Try adding

response.write "looping"

in your loop. If you don't see that at all, your loop is being bypassed.

Ray at work

"Ken Fine" <ke*****@u.washington.edu> wrote in message
news:bk***********@nntp6.u.washington.edu...
Thanks for the help. Unfortunately, this code is returning nothing into the var sResult, when I know there is content to be had in the recordset. Can
you think of any obvious error in the code which might be blanking out the
variable?
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:e8**************@TK2MSFTNGP09.phx.gbl...
I ~think~ this is what you're trying to do.

sResult = ""
Do while Not rsConfirmedSpeakers.EOF and Repeat1_numRows <> 0
sResult = sResult &
rsConfirmedSpeakers.Fields.Item("Per_GivenName").V alue
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsConfirmedSpeakers.MoveNext()

Loop

Response.Write sResult

Ray at work

"Ken Fine" <ke*****@u.washington.edu> wrote in message
news:bk***********@nntp6.u.washington.edu...
I'm trying to include a list of people that's the result of looping

through
a recordset in a CDONTS mail. I'm trying to Dim the output of a loop,

and
it
ain't working -- I'm getting a syntax error. Any ideas why the following snippet isn't working?

<%
Dim ConfirmedSpeakerList2
ConfirmedSpeakerList2=(While ((Repeat1__numRows <> 0) AND (NOT
rsConfirmedSpeakers.EOF))
(rsConfirmedSpeakers.Fields.Item("Per_GivenName"). Value)

Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsConfirmedSpeakers.MoveNext()
Wend)%>

<%Response.Write ConfirmedSpeakerList2%>

I have the feeling I may be about to learn an unfortunate lesson, but... wait and see.

Are there other ways that I could get looped output embedded in a CDONTS mail? I thought trying to Dim the output of the recordset as a big long string would be the cleanest way to make this happen.

Many thanks.



Jul 19 '05 #4
An obious error would be not initializing to a non-zero value.

Steve

"Ken Fine" <ke*****@u.washington.edu> wrote in message
news:bk***********@nntp6.u.washington.edu...
Thanks for the help. Unfortunately, this code is returning nothing into the var sResult, when I know there is content to be had in the recordset. Can
you think of any obvious error in the code which might be blanking out the
variable?
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:e8**************@TK2MSFTNGP09.phx.gbl...
I ~think~ this is what you're trying to do.

sResult = ""
Do while Not rsConfirmedSpeakers.EOF and Repeat1_numRows <> 0
sResult = sResult &
rsConfirmedSpeakers.Fields.Item("Per_GivenName").V alue
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsConfirmedSpeakers.MoveNext()

Loop

Response.Write sResult

Ray at work

"Ken Fine" <ke*****@u.washington.edu> wrote in message
news:bk***********@nntp6.u.washington.edu...
I'm trying to include a list of people that's the result of looping

through
a recordset in a CDONTS mail. I'm trying to Dim the output of a loop,

and
it
ain't working -- I'm getting a syntax error. Any ideas why the following snippet isn't working?

<%
Dim ConfirmedSpeakerList2
ConfirmedSpeakerList2=(While ((Repeat1__numRows <> 0) AND (NOT
rsConfirmedSpeakers.EOF))
(rsConfirmedSpeakers.Fields.Item("Per_GivenName"). Value)

Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsConfirmedSpeakers.MoveNext()
Wend)%>

<%Response.Write ConfirmedSpeakerList2%>

I have the feeling I may be about to learn an unfortunate lesson, but... wait and see.

Are there other ways that I could get looped output embedded in a CDONTS mail? I thought trying to Dim the output of the recordset as a big long string would be the cleanest way to make this happen.

Many thanks.



Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Rudolf Bargholz | last post: by
8 posts views Thread by yinglcs | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.