Record Set List separated by Commas

Record Set List separated by Commas

am 05.09.2005 21:07:29 von Doug

Hello again,

I know some of my questions are pretty basic, but I am just learning and I
am not a programmer by trade. Here goes. I am listing items from a
recordset and want to separated them on the page by commas, but I don't want
a comma after the last field. Here is what I am using, but it puts a comma
after the last entry too. How do I get around this?
______________________________

Do Until RS.eof
Response.Write(RS3("OrgName"))
Response.Write","
RS.movenext
loop
______________________________

Thanks,

Doug

Re: Record Set List separated by Commas

am 05.09.2005 21:20:29 von Steven Burn

lCount = 0
Do Until RS.eof
Response.Write RS3("OrgName") << parenthesis not required
If lCount < (rs.RecordCount -1) Then
Response.Write ","
End If
lCount = lCount + 1
RS.movenext
loop

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Doug" wrote in message
news:UH0Te.7782$UI.6256@okepread05...
> Hello again,
>
> I know some of my questions are pretty basic, but I am just learning and I
> am not a programmer by trade. Here goes. I am listing items from a
> recordset and want to separated them on the page by commas, but I don't
want
> a comma after the last field. Here is what I am using, but it puts a
comma
> after the last entry too. How do I get around this?
> ______________________________
>
> Do Until RS.eof
> Response.Write(RS3("OrgName"))
> Response.Write","
> RS.movenext
> loop
> ______________________________
>
> Thanks,
>
> Doug
>
>

Re: Record Set List separated by Commas

am 05.09.2005 21:22:14 von exjxw.hannivoort

Doug wrote on 05 sep 2005 in microsoft.public.inetserver.asp.db:

> Hello again,
>
> I know some of my questions are pretty basic, but I am just learning
> and I am not a programmer by trade. Here goes. I am listing items
> from a recordset and want to separated them on the page by commas, but
> I don't want a comma after the last field. Here is what I am using,
> but it puts a comma after the last entry too. How do I get around
> this? ______________________________
>
> Do Until RS.eof
> Response.Write(RS3("OrgName"))
> Response.Write","
> RS.movenext
> loop
> ______________________________

There are many ways aroud this, I show one
that also works with an empty list:

nostart = false
Do Until RS.eof
if nostart then Response.Write","
nostart = true
Response.Write(RS3("OrgName"))
RS.movenext
Loop



--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Re: Record Set List separated by Commas

am 05.09.2005 21:39:14 von Doug

Seems to work perfectly! Thanks for the help.

Doug

"Evertjan." wrote in message
news:Xns96C8D9651FBE5eejj99@194.109.133.242...
> Doug wrote on 05 sep 2005 in microsoft.public.inetserver.asp.db:
>
> > Hello again,
> >
> > I know some of my questions are pretty basic, but I am just learning
> > and I am not a programmer by trade. Here goes. I am listing items
> > from a recordset and want to separated them on the page by commas, but
> > I don't want a comma after the last field. Here is what I am using,
> > but it puts a comma after the last entry too. How do I get around
> > this? ______________________________
> >
> > Do Until RS.eof
> > Response.Write(RS3("OrgName"))
> > Response.Write","
> > RS.movenext
> > loop
> > ______________________________
>
> There are many ways aroud this, I show one
> that also works with an empty list:
>
> nostart = false
> Do Until RS.eof
> if nostart then Response.Write","
> nostart = true
> Response.Write(RS3("OrgName"))
> RS.movenext
> Loop
>
>
>
> --
> Evertjan.
> The Netherlands.
> (Replace all crosses with dots in my emailaddress)
>

Re: Record Set List separated by Commas

am 05.09.2005 22:14:19 von reb01501

Doug wrote:
> Hello again,
>
> I know some of my questions are pretty basic, but I am just learning
> and I am not a programmer by trade. Here goes. I am listing items
> from a recordset and want to separated them on the page by commas,
> but I don't want a comma after the last field. Here is what I am
> using, but it puts a comma after the last entry too. How do I get
> around this? ______________________________
>
> Do Until RS.eof
> Response.Write(RS3("OrgName"))
> Response.Write","
> RS.movenext
> loop
> ______________________________
>
> Thanks,
>
> Doug

You've neglected the GetString function.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: Record Set List separated by Commas

am 06.09.2005 00:01:00 von Doug

Interesting. I am not a programmer but always trying to learn things to
better my knowledge in this area. I did look up this function and tried to
get it to work for what I want, but I can't seem to separate the values by
commas...I'll keep trying.

Thanks

Doug

"Bob Barrows [MVP]" wrote in message
news:uvaUmZlsFHA.2008@TK2MSFTNGP10.phx.gbl...
> Doug wrote:
> > Hello again,
> >
> > I know some of my questions are pretty basic, but I am just learning
> > and I am not a programmer by trade. Here goes. I am listing items
> > from a recordset and want to separated them on the page by commas,
> > but I don't want a comma after the last field. Here is what I am
> > using, but it puts a comma after the last entry too. How do I get
> > around this? ______________________________
> >
> > Do Until RS.eof
> > Response.Write(RS3("OrgName"))
> > Response.Write","
> > RS.movenext
> > loop
> > ______________________________
> >
> > Thanks,
> >
> > Doug
>
> You've neglected the GetString function.
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>

Re: Record Set List separated by Commas

am 06.09.2005 01:38:10 von Steven Burn

Because RS has become RS3??

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Doug" wrote in message
news:Ae3Te.7787$UI.374@okepread05...
> Interesting. I am not a programmer but always trying to learn things to
> better my knowledge in this area. I did look up this function and tried
to
> get it to work for what I want, but I can't seem to separate the values by
> commas...I'll keep trying.
>
> Thanks
>
> Doug
>
> "Bob Barrows [MVP]" wrote in message
> news:uvaUmZlsFHA.2008@TK2MSFTNGP10.phx.gbl...
> > Doug wrote:
> > > Hello again,
> > >
> > > I know some of my questions are pretty basic, but I am just learning
> > > and I am not a programmer by trade. Here goes. I am listing items
> > > from a recordset and want to separated them on the page by commas,
> > > but I don't want a comma after the last field. Here is what I am
> > > using, but it puts a comma after the last entry too. How do I get
> > > around this? ______________________________
> > >
> > > Do Until RS.eof
> > > Response.Write(RS3("OrgName"))
> > > Response.Write","
> > > RS.movenext
> > > loop
> > > ______________________________
> > >
> > > Thanks,
> > >
> > > Doug
> >
> > You've neglected the GetString function.
> >
> > --
> > Microsoft MVP - ASP/ASP.NET
> > Please reply to the newsgroup. This email account is my spam trap so I
> > don't check it very often. If you must reply off-line, then remove the
> > "NO SPAM"
> >
> >
>
>

Re: Record Set List separated by Commas

am 06.09.2005 01:49:30 von Roland Hall

"Steven Burn" wrote in message news:uMLumLnsFHA.3216@TK2MSFTNGP12.phx.gbl...
: Because RS has become RS3??

Anyone who has ever made this mistake raise your hand.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Re: Record Set List separated by Commas

am 06.09.2005 02:09:23 von Steven Burn

hehe, if I had enough hands I'd definitely be raising more than two

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Roland Hall" wrote in message
news:#$#q2RnsFHA.464@TK2MSFTNGP15.phx.gbl...
> "Steven Burn" wrote in message
news:uMLumLnsFHA.3216@TK2MSFTNGP12.phx.gbl...
> : Because RS has become RS3??
>
> Anyone who has ever made this mistake raise your hand.
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
> MSDN Library - http://msdn.microsoft.com/library/default.asp
>
>

Re: Record Set List separated by Commas

am 06.09.2005 02:33:54 von Doug

Had a little problem with this one, but I get the idea.

Thanks!

Doug

"Steven Burn" wrote in message
news:emo1n7ksFHA.3640@tk2msftngp13.phx.gbl...
> lCount = 0
> Do Until RS.eof
> Response.Write RS3("OrgName") << parenthesis not required
> If lCount < (rs.RecordCount -1) Then
> Response.Write ","
> End If
> lCount = lCount + 1
> RS.movenext
> loop
>
> --
> Regards
>
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>
> Keeping it FREE!
>
> "Doug" wrote in message
> news:UH0Te.7782$UI.6256@okepread05...
> > Hello again,
> >
> > I know some of my questions are pretty basic, but I am just learning and
I
> > am not a programmer by trade. Here goes. I am listing items from a
> > recordset and want to separated them on the page by commas, but I don't
> want
> > a comma after the last field. Here is what I am using, but it puts a
> comma
> > after the last entry too. How do I get around this?
> > ______________________________
> >
> > Do Until RS.eof
> > Response.Write(RS3("OrgName"))
> > Response.Write","
> > RS.movenext
> > loop
> > ______________________________
> >
> > Thanks,
> >
> > Doug
> >
> >
>
>

Re: Record Set List separated by Commas

am 06.09.2005 05:13:29 von Doug

No. I figured that out. Not that I haven't made that mistake before! It's
the whole "adClipString", row delimiter etc... no biggie though...

Doug

"Steven Burn" wrote in message
news:uMLumLnsFHA.3216@TK2MSFTNGP12.phx.gbl...
> Because RS has become RS3??
>
> --
> Regards
>
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>
> Keeping it FREE!
>
> "Doug" wrote in message
> news:Ae3Te.7787$UI.374@okepread05...
> > Interesting. I am not a programmer but always trying to learn things to
> > better my knowledge in this area. I did look up this function and tried
> to
> > get it to work for what I want, but I can't seem to separate the values
by
> > commas...I'll keep trying.
> >
> > Thanks
> >
> > Doug
> >
> > "Bob Barrows [MVP]" wrote in message
> > news:uvaUmZlsFHA.2008@TK2MSFTNGP10.phx.gbl...
> > > Doug wrote:
> > > > Hello again,
> > > >
> > > > I know some of my questions are pretty basic, but I am just learning
> > > > and I am not a programmer by trade. Here goes. I am listing items
> > > > from a recordset and want to separated them on the page by commas,
> > > > but I don't want a comma after the last field. Here is what I am
> > > > using, but it puts a comma after the last entry too. How do I get
> > > > around this? ______________________________
> > > >
> > > > Do Until RS.eof
> > > > Response.Write(RS3("OrgName"))
> > > > Response.Write","
> > > > RS.movenext
> > > > loop
> > > > ______________________________
> > > >
> > > > Thanks,
> > > >
> > > > Doug
> > >
> > > You've neglected the GetString function.
> > >
> > > --
> > > Microsoft MVP - ASP/ASP.NET
> > > Please reply to the newsgroup. This email account is my spam trap so I
> > > don't check it very often. If you must reply off-line, then remove the
> > > "NO SPAM"
> > >
> > >
> >
> >
>
>

Re: Record Set List separated by Commas

am 06.09.2005 07:22:12 von Roland Hall

"Doug" wrote in message
news:wP7Te.7798$UI.3724@okepread05...
: No. I figured that out. Not that I haven't made that mistake before!
It's
: the whole "adClipString", row delimiter etc... no biggie though...

Are you saying you're not able to work it out using getString?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Re: Record Set List separated by Commas

am 09.09.2005 06:17:16 von Doug

Roland,

In short, yes. I don't have to though I have it working another way, but I
was just trying to learn about the GetString Function.

Doug

"Roland Hall" wrote in message
news:%23AbmwLqsFHA.2064@TK2MSFTNGP09.phx.gbl...
>
> "Doug" wrote in message
> news:wP7Te.7798$UI.3724@okepread05...
> : No. I figured that out. Not that I haven't made that mistake before!
> It's
> : the whole "adClipString", row delimiter etc... no biggie though...
>
> Are you saying you're not able to work it out using getString?
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
> MSDN Library - http://msdn.microsoft.com/library/default.asp
>
>

Re: Record Set List separated by Commas

am 09.09.2005 10:54:17 von Roland Hall

"Doug" wrote in message news:g18Ue.8237$UI.2904@okepread05...
: Roland,
:
: In short, yes. I don't have to though I have it working another way, but
I
: was just trying to learn about the GetString Function.

String = recordset.GetString(StringFormat, NumRows, ColumnDelimiter,
RowDelimiter, NullExpr)

if not *rs3.bof or rs3.eof) then
str = rs3.GetString(adClipString,,,",","")
Response.Write str
else
Response.Write "No records returned."
Response.End
end if

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Re: Record Set List separated by Commas

am 13.09.2005 05:48:35 von Doug

Roland,

I still can't get it to work. I'm not sure if I'm applying it correctly.
Here is what I am using that does work. I did change your posted reply to
this:

if not (rs8.bof or rs8.eof) then
str = rs8.GetString(adClipString,,,",","")
Response.Write str
else
Response.Write "No records returned."
Response.End
end if

What I am using now to do this and it works:

If RS8.eof Then
Response.Write"-"
Else
nostart = false
Do Until RS8.eof
if nostart then Response.Write", "
nostart = true
Response.Write"" &
(RS8("OrgAbbrev")) & "
"
RS8.movenext
Loop
End If



"Roland Hall" wrote in message
news:%23tf%23QwRtFHA.2392@tk2msftngp13.phx.gbl...
> "Doug" wrote in message news:g18Ue.8237$UI.2904@okepread05...
> : Roland,
> :
> : In short, yes. I don't have to though I have it working another way,
but
> I
> : was just trying to learn about the GetString Function.
>
> String = recordset.GetString(StringFormat, NumRows, ColumnDelimiter,
> RowDelimiter, NullExpr)
>
> if not *rs3.bof or rs3.eof) then
> str = rs3.GetString(adClipString,,,",","")
> Response.Write str
> else
> Response.Write "No records returned."
> Response.End
> end if
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
> MSDN Library - http://msdn.microsoft.com/library/default.asp
>
>

Re: Record Set List separated by Commas

am 13.09.2005 14:25:38 von reb01501

You would get better help if you better-defined what you mean by "doesn't
work".

If all you want to do is strip out the last comma, then:

if not rs8.eof then
str = rs8.GetString(adClipString,,,",","")
Response.Write left(str,len(str)-1)
etc.

I am a little concerned about "rs8" ... are you really opening 8 recordsets
on this page?

Bob Barrows


Doug wrote:
> Roland,
>
> I still can't get it to work. I'm not sure if I'm applying it
> correctly. Here is what I am using that does work. I did change your
> posted reply to this:
>
> if not (rs8.bof or rs8.eof) then
> str = rs8.GetString(adClipString,,,",","")
> Response.Write str
> else
> Response.Write "No records returned."
> Response.End
> end if
>
> What I am using now to do this and it works:
>
> If RS8.eof Then
> Response.Write"-"
> Else
> nostart = false
> Do Until RS8.eof
> if nostart then Response.Write", "
> nostart = true
> Response.Write" > class='popup'>" & (RS8("OrgAbbrev")) & ""
> RS8.movenext
> Loop
> End If
>
>
>
> "Roland Hall" wrote in message
> news:%23tf%23QwRtFHA.2392@tk2msftngp13.phx.gbl...
>> "Doug" wrote in message news:g18Ue.8237$UI.2904@okepread05...
>>> Roland,
>>>
>>> In short, yes. I don't have to though I have it working another
>>> way, but I was just trying to learn about the GetString Function.
>>
>> String = recordset.GetString(StringFormat, NumRows, ColumnDelimiter,
>> RowDelimiter, NullExpr)
>>
>> if not *rs3.bof or rs3.eof) then
>> str = rs3.GetString(adClipString,,,",","")
>> Response.Write str
>> else
>> Response.Write "No records returned."
>> Response.End
>> end if
>>
>> --
>> Roland Hall
>> /* This information is distributed in the hope that it will be
>> useful, but without any warranty; without even the implied warranty
>> of merchantability or fitness for a particular purpose. */
>> Technet Script Center -
>> http://www.microsoft.com/technet/scriptcenter/ WSH 5.6 Documentation
>> -
> http://msdn.microsoft.com/downloads/list/webdev.asp
>> MSDN Library - http://msdn.microsoft.com/library/default.asp

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.