|
-
Jul 6th, 2001, 03:41 AM
#1
Thread Starter
Addicted Member
Drop-down list problem
Hi all,
I have a drop-down listbox in my ASP page. I populate its content from a database. When the user chooses a value, it gets stored in the database only partially.
For instance, if I choose 'ABC Company Ltd', it gets saved onyl as 'ABC'. Similarly, it gets saved only till the blankspace.
Any guess why this is like this? I checked for ehe entire code, its all correct.
Kindly help
-
Jul 6th, 2001, 03:43 AM
#2
in the value make sure you have " " or ' 'around the text
Code:
value="ABC Company Ltd"
-
Jul 6th, 2001, 04:00 AM
#3
Thread Starter
Addicted Member
Hi Chenko,
Here is the code which I use. Kindly help me
<select name="brk_air">
<%
' dim var_sel_brk_air
rs.open "select * from schenker_master",cn,0,1
rs.movefirst
while not rs.EOF
if rs("prospect_id") = var_ses_pros_id then
var_sel_brk_air = rs("brk_air_name")
end if
rs.movenext
wend
rs.close
rs.open "select * from schenker_broker_air",cn,0,1
rs.movefirst
while not rs.EOF
if rs("brk_air_name") = var_sel_brk_air then
response.write ("<option value=" & rs("brk_air_name") & " selected>" & rs("brk_air_name") & "</option>")
else
response.write ("<option value=" & rs("brk_air_name") & ">" & rs("brk_air_name") & "</option>")
end if
rs.movenext
wend
rs.close
%>
</select>
</td>
</tr>
..
..
-
Jul 6th, 2001, 04:18 AM
#4
Originally posted by Parasu Raman
Hi Chenko,
Here is the code which I use. Kindly help me
<select name="brk_air">
<%
' dim var_sel_brk_air
rs.open "select * from schenker_master",cn,0,1
rs.movefirst
while not rs.EOF
if rs("prospect_id") = var_ses_pros_id then
var_sel_brk_air = rs("brk_air_name")
end if
rs.movenext
wend
rs.close
rs.open "select * from schenker_broker_air",cn,0,1
rs.movefirst
while not rs.EOF
if rs("brk_air_name") = var_sel_brk_air then
response.write ("<option value='" & rs("brk_air_name") & "' selected>" & rs("brk_air_name") & "</option>")
else
response.write ("<option value='" & rs("brk_air_name") & "'>" & rs("brk_air_name") & "</option>")
end if
rs.movenext
wend
rs.close
%>
</select>
</td>
</tr>
..
..
Ok, ive edited your code, I put ' ' in as you are using response.write, and also you needed a space before the "selected"
-
Jul 6th, 2001, 04:33 AM
#5
Thread Starter
Addicted Member
Chenko,
Thanx alot. It works perfect.
-
Jul 6th, 2001, 12:25 PM
#6
Frenzied Member
On a side note, why don't you use where clauses in your SQL statements. You should not load all the data then loop through it to find one record. Just ask the database for the record that matches your criteria.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Jul 7th, 2001, 01:23 AM
#7
Thread Starter
Addicted Member
Hi Monte96,
Thats a good idea. I'll do that hereafterwards. I understand that it reduces the retrieval time
Thanx again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|