Still Not Resolved

Still Not Resolved

am 22.08.2007 17:40:04 von jack

Hi,
I want to display two fiels from a query in a combo box. I am checking to
make sure that the the selected fields do generate value. However, in the
combo box, I have only one field that is being displayed instead of two
fields. I would like to know whether this can be solved in the existing code?
Thanks

CODE:


Populating two fields in combo box from a query




Populating two fields in combo box from a query



<%
Dim oConn
Dim oRS
Dim vCS
Dim sqltxt

set oConn=server.CreateObject("ADODB.connection")
vCS = "Provider=Microsoft.Jet.OLEDB.4.0"
vCS = vCS & "; Data Source=C:\Sailors.mdb"
oConn.connectionstring = vCS
oConn.Open

set oRS = server.CreateObject("ADODB.recordset")
sqltxt = "SELECT BoatName, BoatClass FROM Boats;"
oRS.Open sqltxt,oConn
Response.Write sqltxt & "
"
Response.Write oRS("BoatName") & "
"
Response.Write oRS("BoatClass") & "
"
'Response.End
%>

<%oRS.Close
Set oRS = nothing %>

<%'Response.Write "Hey You" & "
" %>

Re: Still Not Resolved

am 22.08.2007 19:09:31 von reb01501

Jack wrote:
> Hi,
> I want to display two fiels from a query in a combo box. I am
> checking to make sure that the the selected fields do generate value.
> However, in the combo box, I have only one field that is being
> displayed instead of two fields. I would like to know whether this
> can be solved in the existing code? Thanks

Please show us the html that results from the code.
--
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.

Re: Still Not Resolved

am 22.08.2007 20:18:05 von jack

Bob,
Here is the output in html. Thanks
OUTPUT:



Populating two fields in combo box from a query




Populating two fields in combo box from a query



SELECT BoatName, BoatClass FROM Boats;
A Sweet Song
Laser







"Bob Barrows [MVP]" wrote:

> Jack wrote:
> > Hi,
> > I want to display two fiels from a query in a combo box. I am
> > checking to make sure that the the selected fields do generate value.
> > However, in the combo box, I have only one field that is being
> > displayed instead of two fields. I would like to know whether this
> > can be solved in the existing code? Thanks
>
> Please show us the html that results from the code.
> --
> 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.
>
>
>

Re: Still Not Resolved

am 22.08.2007 20:36:09 von reb01501

If the data in Boats looks like this:
A Sweet Song | Laser
Blackbeard | Laser
No Excuse to Lose | Laser
No Excuse Two Lose | Laser
White Lightning | Soling
Teal | Soling
TGV | Soling
BB3 | Soling
Nuts and Bolts | Soling
Psycho | Soling
Shasta | Flying Scot
Daphne | Flying Scot
Red White and Blue | Flying Scot

Then that is the output I would expect from your code

What is wrong with it? What do you want it to look like?

Jack wrote:
> Bob,
> Here is the output in html. Thanks
> OUTPUT:
>
>
>
> Populating two fields in combo box from a query
>
>
>
>


> Populating two fields in combo box from a query


>
> SELECT BoatName, BoatClass FROM Boats;
A Sweet Song
Laser

>
>
>
>
>

--
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.

Re: Still Not Resolved

am 22.08.2007 21:14:00 von jack

Bob,
In my combo box, I am seeing only one field with the output as
Laser
Laser
Laser
Laser
Soling
Soling
Soling
Soling
Soling
Soling
Flying Scot
Flying Scot
Flying Scot
That's the problem I have. Do you think the size of the combo box needs to
be widened to accommodate the first field or what? Thanks.

"Bob Barrows [MVP]" wrote:

> If the data in Boats looks like this:
> A Sweet Song | Laser
> Blackbeard | Laser
> No Excuse to Lose | Laser
> No Excuse Two Lose | Laser
> White Lightning | Soling
> Teal | Soling
> TGV | Soling
> BB3 | Soling
> Nuts and Bolts | Soling
> Psycho | Soling
> Shasta | Flying Scot
> Daphne | Flying Scot
> Red White and Blue | Flying Scot
>
> Then that is the output I would expect from your code
>
> What is wrong with it? What do you want it to look like?
>
> Jack wrote:
> > Bob,
> > Here is the output in html. Thanks
> > OUTPUT:
> >
> >
> >
> > Populating two fields in combo box from a query
> >
> >
> >
> >


> > Populating two fields in combo box from a query


> >
> > SELECT BoatName, BoatClass FROM Boats;
A Sweet Song
Laser

> >
> >
> >
> >
> >
>
> --
> 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.
>
>
>

Re: Still Not Resolved

am 22.08.2007 21:28:17 von reb01501

No, resizing won't do anything. The combo box (actually, it is called a
"dropdown", or, better yet, a "select" - there is no such combo box in
html) is displaying exactly what the html is telling it to display.

Look at one of the option tags:

It sounds as if you are expecting the content of the value attribute ("A
Sweet Song") to be displayed as well as the option tag's text ("Laser" -
the portion between the opening and closing tags). Sorry, it just does
not work that way. The dropdown will display whatever is in the text,
and only what is in the text. So you need to modify your code to make
the resulting html look the way you want it to look, probably via
concatenation. Start with straight html. Write small .htm a page
containing hard-coded html that gives you what you want. Then go back to
your code and modify it so that it results in the same html.


Jack wrote:
> Bob,
> In my combo box, I am seeing only one field with the output as
> Laser
> Laser
> Laser
> Laser
> Soling
> Soling
> Soling
> Soling
> Soling
> Soling
> Flying Scot
> Flying Scot
> Flying Scot
> That's the problem I have. Do you think the size of the combo box
> needs to be widened to accommodate the first field or what? Thanks.
>
> "Bob Barrows [MVP]" wrote:
>
>> If the data in Boats looks like this:
>> A Sweet Song | Laser
>> Blackbeard | Laser
>> No Excuse to Lose | Laser
>> No Excuse Two Lose | Laser
>> White Lightning | Soling
>> Teal | Soling
>> TGV | Soling
>> BB3 | Soling
>> Nuts and Bolts | Soling
>> Psycho | Soling
>> Shasta | Flying Scot
>> Daphne | Flying Scot
>> Red White and Blue | Flying Scot
>>
>> Then that is the output I would expect from your code
>>
>> What is wrong with it? What do you want it to look like?
>>
>> Jack wrote:
>>> Bob,
>>> Here is the output in html. Thanks
>>> OUTPUT:
>>>
>>>
>>>
>>> Populating two fields in combo box from a query
>>>
>>>
>>>
>>>


>>> Populating two fields in combo box from a query


>>>
>>> SELECT BoatName, BoatClass FROM Boats;
A Sweet Song
Laser

>>>
>>>
>>>
>>>
>>>
>>
>> --
>> 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.

--
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.

Re: Still Not Resolved

am 22.08.2007 21:38:01 von jack

Thanks for the advise Bob. I appreciate it. I will try it. Thanks again.

"Bob Barrows [MVP]" wrote:

> No, resizing won't do anything. The combo box (actually, it is called a
> "dropdown", or, better yet, a "select" - there is no such combo box in
> html) is displaying exactly what the html is telling it to display.
>
> Look at one of the option tags:
>
> It sounds as if you are expecting the content of the value attribute ("A
> Sweet Song") to be displayed as well as the option tag's text ("Laser" -
> the portion between the opening and closing tags). Sorry, it just does
> not work that way. The dropdown will display whatever is in the text,
> and only what is in the text. So you need to modify your code to make
> the resulting html look the way you want it to look, probably via
> concatenation. Start with straight html. Write small .htm a page
> containing hard-coded html that gives you what you want. Then go back to
> your code and modify it so that it results in the same html.
>
>
> Jack wrote:
> > Bob,
> > In my combo box, I am seeing only one field with the output as
> > Laser
> > Laser
> > Laser
> > Laser
> > Soling
> > Soling
> > Soling
> > Soling
> > Soling
> > Soling
> > Flying Scot
> > Flying Scot
> > Flying Scot
> > That's the problem I have. Do you think the size of the combo box
> > needs to be widened to accommodate the first field or what? Thanks.
> >
> > "Bob Barrows [MVP]" wrote:
> >
> >> If the data in Boats looks like this:
> >> A Sweet Song | Laser
> >> Blackbeard | Laser
> >> No Excuse to Lose | Laser
> >> No Excuse Two Lose | Laser
> >> White Lightning | Soling
> >> Teal | Soling
> >> TGV | Soling
> >> BB3 | Soling
> >> Nuts and Bolts | Soling
> >> Psycho | Soling
> >> Shasta | Flying Scot
> >> Daphne | Flying Scot
> >> Red White and Blue | Flying Scot
> >>
> >> Then that is the output I would expect from your code
> >>
> >> What is wrong with it? What do you want it to look like?
> >>
> >> Jack wrote:
> >>> Bob,
> >>> Here is the output in html. Thanks
> >>> OUTPUT:
> >>>
> >>>
> >>>
> >>> Populating two fields in combo box from a query
> >>>
> >>>
> >>>
> >>>


> >>> Populating two fields in combo box from a query


> >>>
> >>> SELECT BoatName, BoatClass FROM Boats;
A Sweet Song
Laser

> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >> --
> >> 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.
>
> --
> 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.
>
>
>

Re: Still Not Resolved

am 17.09.2007 14:14:26 von Andyza

On Aug 22, 9:28 pm, "Bob Barrows [MVP]"
wrote:

> Look at one of the option tags:
>
> It sounds as if you are expecting the content of the value attribute ("A
> Sweet Song") to be displayed as well as the option tag's text ("Laser" -
> the portion between the opening and closing tags). Sorry, it just does
> not work that way. The dropdown will display whatever is in the text,
> and only what is in the text. So you need to modify your code to make
> the resulting html look the way you want it to look, probably via
> concatenation.

Something like:

Do while not oRS.EOF
response.Write "

Re: Still Not Resolved

am 17.09.2007 17:09:16 von exjxw.hannivoort

Andyza wrote on 17 sep 2007 in microsoft.public.inetserver.asp.db:

> Do while not oRS.EOF
> response.Write "

<%
oRS.MoveNext
Loop
%>

Much less error prone for me at least.

[oRS("BoatName") shoud not contain an apostrophe, btw]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Still Not Resolved

am 18.09.2007 08:07:17 von Adrienne Boswell

Gazing into my crystal ball I observed "Evertjan."
writing in news:Xns99AEAE807E270eejj99@
194.109.133.242:

> Andyza wrote on 17 sep 2007 in microsoft.public.inetserver.asp.db:
>
>> Do while not oRS.EOF
>> response.Write "
>
><%
> oRS.MoveNext
> Loop
> %>
>
> Much less error prone for me at least.
>
> [oRS("BoatName") shoud not contain an apostrophe, btw]
>

Even better for the user:




--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Re: Still Not Resolved

am 18.09.2007 08:53:20 von exjxw.hannivoort

Adrienne Boswell wrote on 18 sep 2007 in
microsoft.public.inetserver.asp.db:

> <% ors.movenext
> wend
> ors.close
> set obs = nothing
> %>
>

ors = Oral Rehydration Salts

obs? [oops?] It is nothing. ;-)

More seriously:

I presume that,
if the end of the serverside page code execution is near,
the ASP engine will take care of such closing and nothinging
without any performance damage.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)