Cuttie0506
02-15-2006, 02:35 PM
Hi..
I have a dropdown list with a number of classes.. Those classes refers to the columns names in the db...
When i selected i class, i will search that column in m db...
"listCol" is the column name i request.form("class")
After i have selected the information out, i want to display the data in a dropdown box...
But how do i specify is from which column?
Code for getting the data from the selected column:
dim sqlString
Dim rs_vList
Set rs_vList = Server.CreateObject("ADODB.Recordset")
rs_vList.ActiveConnection = MM_dsprms_STRING
dim listCol
listCol = request.form("class")
sqlString = "SELECT DISTINCT " & listCol & " From Sys_Config_Table"
rs_vList.Source = sqlString
rs_vList.CursorType = 0
rs_vList.CursorLocation = 2
rs_vList.LockType = 1
rs_vList.Open()
Code for the dropdown list
<tr> <td>List: </td>
<td><select name=list id=select>
<%While (NOT rs_vListSearch.EOF)%>
<option value="<%=(rs_vListSearch.Fields.Item(" ").Value)%>"<%If (Not isNull((Session("list")))) Then If (CStr(rs_vListSearch.Fields.Item(" ").Value) = CStr((Session(" ")))) Then Response.Write("SELECTED")%>><%=(rs_vListSearch.Fields.Item(" ").Value)%></option>
<%
rs_vListSearch.MoveNext()
Wend
If (rs_vListSearch.CursorType > 0) Then
rs_vListSearch.MoveFirst
Else
rs_vListSearch.Requery
End If
%>
</select></td>
What should i put for my "rs_vListSearch.Fields.Item("list").Value", the value inside the bracket? Coz normally i will put my colName, but this time the col name i get using another dropdown list.
Thanx
I have a dropdown list with a number of classes.. Those classes refers to the columns names in the db...
When i selected i class, i will search that column in m db...
"listCol" is the column name i request.form("class")
After i have selected the information out, i want to display the data in a dropdown box...
But how do i specify is from which column?
Code for getting the data from the selected column:
dim sqlString
Dim rs_vList
Set rs_vList = Server.CreateObject("ADODB.Recordset")
rs_vList.ActiveConnection = MM_dsprms_STRING
dim listCol
listCol = request.form("class")
sqlString = "SELECT DISTINCT " & listCol & " From Sys_Config_Table"
rs_vList.Source = sqlString
rs_vList.CursorType = 0
rs_vList.CursorLocation = 2
rs_vList.LockType = 1
rs_vList.Open()
Code for the dropdown list
<tr> <td>List: </td>
<td><select name=list id=select>
<%While (NOT rs_vListSearch.EOF)%>
<option value="<%=(rs_vListSearch.Fields.Item(" ").Value)%>"<%If (Not isNull((Session("list")))) Then If (CStr(rs_vListSearch.Fields.Item(" ").Value) = CStr((Session(" ")))) Then Response.Write("SELECTED")%>><%=(rs_vListSearch.Fields.Item(" ").Value)%></option>
<%
rs_vListSearch.MoveNext()
Wend
If (rs_vListSearch.CursorType > 0) Then
rs_vListSearch.MoveFirst
Else
rs_vListSearch.Requery
End If
%>
</select></td>
What should i put for my "rs_vListSearch.Fields.Item("list").Value", the value inside the bracket? Coz normally i will put my colName, but this time the col name i get using another dropdown list.
Thanx