473,566 Members | 3,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

doubt regarding select box....urgent

47 New Member
doubt regarding select box....urgent
in the below code i am getting data from database..accor ding to the condition..
i want the available data in database to get displayed in selectbox..

for ex...
in the code i am getting color=rs("color ")according to the condtion if(shirt=name)
if i get red, blue as result the i want these two colors to be in selectbox..
if its three colors means i want those three colors to get displayed in selectbox..

how to do this

regards
meenu


<%
set con=server.crea teobject("adodb .connection")
set rs=server.creat eobject("adodb. recordset")

Con.Open "dsn=tshirt "

set rs=con.execute( "select * from table1")
while not rs.eof
name=rs("name")

if(shirt=name)t hen
color1=rs("colo r")

%>
<select name="color">
<option value="<%=color 1%>"><%=color1% ></option>
<%
end if
rs.movenext
wend
%>
Jul 21 '06 #1
5 2301
cbrao
3 New Member
Put your <Select ..> Tag out side while loop. It should be like this..

<%
set con=server.crea teobject("adodb .connection")
set rs=server.creat eobject("adodb. recordset")

Con.Open "dsn=tshirt "

set rs=con.execute( "select * from table1")
if Not(rs.eof and rs.bof) Then
response.write "<select name="color">"
while not rs.eof
name=rs("name")
if(shirt=name)t hen
color1=rs("colo r")
%>
<option value="<%=color 1%>"><%=color1% ></option>
<%
end if
rs.movenext
wend
response.write "</select>"
else
''''Do something that have no values
End if
%>
Jul 22 '06 #2
meenu_susi
47 New Member
thanks for ur reply...
i tried that but the following error occurs...
in response.write

Microsoft VBScript compilation (0x800A0401)
Expected end of statement

response.write "<select name="color">"
-----------------------------^
Jul 22 '06 #3
meenu_susi
47 New Member
hi cbaro..

i got it worked...
i have made a small change in the code...and it worked..
i have placed the select statement outside the while loop...thats what the change..
anyway thanks for ur suggection...
<%
set con=server.crea teobject("adodb .connection")
set rs=server.creat eobject("adodb. recordset")

Con.Open "dsn=tshirt "

set rs=con.execute( "select * from table1")
%>
<select name="color">
<%
while not rs.eof
name=rs("name")

if(shirt=name)t hen
color1=rs("colo r")

%>

<option value="<%=color 1%>"><%=color1% ></option>
<%
end if
rs.movenext
wend
%>


with regards
meenu
Jul 22 '06 #4
iam_clint
1,208 Recognized Expert Top Contributor
Put your <Select ..> Tag out side while loop. It should be like this..

<%
set con=server.crea teobject("adodb .connection")
set rs=server.creat eobject("adodb. recordset")

Con.Open "dsn=tshirt "

set rs=con.execute( "select * from table1")
if Not(rs.eof and rs.bof) Then
response.write "<select name="color">"
while not rs.eof
name=rs("name")
if(shirt=name)t hen
color1=rs("colo r")
%>
<option value="<%=color 1%>"><%=color1% ></option>
<%
end if
rs.movenext
wend
response.write "</select>"
else
''''Do something that have no values
End if
%>
response.write "<select name="color">"
this would never work :) take a look at it

quote<select name=quote color quote>quote
your ending your response.write after the second quote so color">" would still be there thats the unexpected end of statement problem..
Jul 26 '06 #5
meenu_susi
47 New Member
ya i got it...
thanks for ur reply..
and i got it worked also..
see the above code posted my me...
Jul 26 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
5220
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is developing a web-based application, one part of which involves allowing the user the ability to page through transaction "history" information. The...
1
1056
by: ramil | last post by:
Hi, I am Rameel. I am using a software called GZIP in some of my Java programs. But now my client want to convert the software to .NET. So is it possible for me to use the same GZIP package in .NET also? If no could you please suggest me a software which can be used to unzip the file zipped in GZIP. It is for a very urgent requirement. So...
4
1388
by: archana | last post by:
Hi all, I am having one confusion regarding invoking web method of web service asychronously through windows applicaiton. What i am doing is i am having one long runing web method whose one way attribute is set as i don't want any return value from that method. What i observered is when my window application start calling web method...
6
2440
by: Mikus Sleiners | last post by:
Is there any way to enable exception throws in VS 2005, that occur during binding operations? I am upset that i can't see exceptions that are thrown during binding operations. It's very hard to track down erroneous behaviour of your app if you can't see where the problem is... i mean it's realy hard to debug binding issues and it would be...
10
1082
by: Dhananjay | last post by:
hello everyone Do you have any information how to generate a tool using .net which is used to translate the web page contents to html format. Plz reply me asap Thanks in advance Dhananjay
122
4184
by: ivan | last post by:
hi all, if I have: if(A && B || C) which operation gets executed first? If I remeber well should be &&, am I correct? thanks
1
1189
by: jai80 | last post by:
Hi Frenz, am working with xsl, and with a specific criteria, am trying to change the font color of the date value, as it can be seen from the code. Its a table with many rows. Instead of changing the color of the date value in that particular td of the table, i want to change the background color of tht td for tht date. please help me how to...
8
2027
by: somenath | last post by:
Hi All, I have a doubt regarding the pointer assignment . Please have a look at the following program . #include<stdio.h> #include<stdlib.h> #define NAMESIZE 10 #define SAFE_FREE(t) if(t)\ {\
7
1351
by: new to c | last post by:
Hi! I write the 2 codes int i; i = sizeof(long int); printf("%i", i); i = sizeof(int long); printf("%i", i);
0
7673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7645
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.