E
Eugene Anthony
I actually have two combo box on my .asp with the simular code as
bellow:
<select name="select2" class="TextField1">
<%
openDB()
set rs = Server.CreateObject("ADODB.Recordset")
objConn.usp_RetrieveCategories rs
do while not rs.eof
response.write "<option value=" & rs(0) & ">" & rs(1)
rs.movenext
loop
closeRS()
closeDB()
%>
</select>
The stored procedure is as bellow:
create procedure usp_retrieveCategories
AS SET NOCOUNT ON
SELECT CategoryID, CategoryDescription FROM categories
Return
GO
Now I have a table called ProductsCategories:
create table ProductsCategories
(
ItemID int,
CategoryID int
);
I also have the ItemID stored as:
ItemID = formatforDb(Request.QueryString("ItemID"))
Now what I intend to do is lets say I have ItemID 1 in
ProductsCategories table. ItemID 1 can have one or two CategoryID in
ProductsCategories table. If ItemID 1 has only one CategoryID, then the
combobox 1 should focus the CategoryID found in ProductsCategories
table. If suppose ItemID 1 has two CategoryID in ProductsCategories
table, then the first CategoryID of ProductsCategories table should be
the focused on combobox1 and the second CategoryID of ProductsCategories
table should be the focus on combobox2.
For example:
<select name="select1" class="TextField1">
<%
openDB()
set rs = Server.CreateObject("ADODB.Recordset")
objConn.usp_RetrieveCategories rs
do while not rs.eof
%>
<option value='<%=rs(0)%>' <% if rs(0)=Parent then response.write
"selected" end if %>><% =rs(1) %></option>
<%
rs.movenext
loop
closeRS()
closeDB()
%>
</select>
The purpose of the codes above is to modify an existing information
stored in the database.
How is it done?. Your help is kindly appreciated.
Regards
Eugene Anthony
bellow:
<select name="select2" class="TextField1">
<%
openDB()
set rs = Server.CreateObject("ADODB.Recordset")
objConn.usp_RetrieveCategories rs
do while not rs.eof
response.write "<option value=" & rs(0) & ">" & rs(1)
rs.movenext
loop
closeRS()
closeDB()
%>
</select>
The stored procedure is as bellow:
create procedure usp_retrieveCategories
AS SET NOCOUNT ON
SELECT CategoryID, CategoryDescription FROM categories
Return
GO
Now I have a table called ProductsCategories:
create table ProductsCategories
(
ItemID int,
CategoryID int
);
I also have the ItemID stored as:
ItemID = formatforDb(Request.QueryString("ItemID"))
Now what I intend to do is lets say I have ItemID 1 in
ProductsCategories table. ItemID 1 can have one or two CategoryID in
ProductsCategories table. If ItemID 1 has only one CategoryID, then the
combobox 1 should focus the CategoryID found in ProductsCategories
table. If suppose ItemID 1 has two CategoryID in ProductsCategories
table, then the first CategoryID of ProductsCategories table should be
the focused on combobox1 and the second CategoryID of ProductsCategories
table should be the focus on combobox2.
For example:
<select name="select1" class="TextField1">
<%
openDB()
set rs = Server.CreateObject("ADODB.Recordset")
objConn.usp_RetrieveCategories rs
do while not rs.eof
%>
<option value='<%=rs(0)%>' <% if rs(0)=Parent then response.write
"selected" end if %>><% =rs(1) %></option>
<%
rs.movenext
loop
closeRS()
closeDB()
%>
</select>
The purpose of the codes above is to modify an existing information
stored in the database.
How is it done?. Your help is kindly appreciated.
Regards
Eugene Anthony