Re: Recordset used in Select/Option pick list
- From: "WynnGIS" <ArcInfo@xxxxxxxxxxx>
- Date: 25 Sep 2006 07:09:59 -0700
Oh one more questions with this one.
How can I make the Pick List default to something like
Select...
Rather than the first recorder in my recordset
Thanks
Tim
WynnGIS wrote:
Bob,
Thanks...that got me what i needed.
Thanks again for all of your help
Tim
Bob Barrows [MVP] wrote:
WynnGIS wrote:
Bob, still tryin to get this thing to work.
You wrote
Change the code to:
If not rs.EOF then
optHTML=rs.getstring(,,,vbcrlf & "")
That's not what i wrote ... or is it? Did my copy/paste not work
correctly? Let's see ... Darn! This is what should have been pasted:
optHTML=rs.getstring(,,,vbcrlf & "<option>")
<snip>
When I run the above I get the following if I comment out your 2nd
optHTML line
Result of GetString:
3500
5250
5423
5435
5668
Darn, I should have used htmlencode, but you can see the output by
viewing the page's source in the browser (View> Source). However, change
the response.write to:
response.write "<pre>" & server.htmlencode(optHTML) & "</pre>"
What you will see will be similar to:
Result of GetString:
<option>3500
<option>5250
<option>5423
<option>5435
<option>5668
<option>
What the getstring is doing is constructing a string from all the data
in your recordset. Here is a breakdown of statement arguments:
1. format - there is only one format so I just left it blank
2. number of rows - we want them all so again I left it blank
3. field delimiter: the string to be used to separate field values -
since there is only one field in the recordset, I left it blank
4. record delimiter: the string to use after each record. I used vbcrlf
& "<option>" to cause it to put a line break after each record and then
write a new option tag.
So, the method took your recordset, which contained 5 records and
created a string by putting vbcrlf & "<option>" after each record
resulting in what I showed above.
My next step it to add the beginning option tag to the string and strip
the final vbcrlf & "<option>" from the end of the string. I could have
done it in five steps like this (response.writes added for
illustration):
optHTML = "<option>" & optHTML
response.write "<pre>" & server.htmlencode(optHTML) & "</pre>"
x=len(optHTML)
y=len(vbcrlf & "<option>")
desiredlength = x-y
optHTML=Left(optHTML,desiredlength)
response.write "<pre>" & server.htmlencode(optHTML) & "</pre>"
--
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.
.
- Follow-Ups:
- Re: Recordset used in Select/Option pick list
- From: Bob Barrows [MVP]
- Re: Recordset used in Select/Option pick list
- References:
- Recordset used in Select/Option pick list
- From: WynnGIS
- Re: Recordset used in Select/Option pick list
- From: Bob Barrows [MVP]
- Re: Recordset used in Select/Option pick list
- From: WynnGIS
- Re: Recordset used in Select/Option pick list
- From: Bob Barrows [MVP]
- Re: Recordset used in Select/Option pick list
- From: WynnGIS
- Re: Recordset used in Select/Option pick list
- From: Bob Barrows [MVP]
- Re: Recordset used in Select/Option pick list
- From: WynnGIS
- Recordset used in Select/Option pick list
- Prev by Date: Re: Recordset used in Select/Option pick list
- Next by Date: Re: Recordset used in Select/Option pick list
- Previous by thread: Re: Recordset used in Select/Option pick list
- Next by thread: Re: Recordset used in Select/Option pick list
- Index(es):
Relevant Pages
|
|