Forums
This topic is locked
building sql query
Posted 11 Jul 2002 18:20:29
1
has voted
11 Jul 2002 18:20:29 Cycie Cycie posted:
i have the next situation with 2 child/parent listboxesform1 - listbox 1 - parent
form2 - listbox 2 - child
when form1 is submitted listbox 2 will be build up with the next recordset :
<%
' Parent Child DropDown - Open Child Recordset
set rsChildDropDown = Server.CreateObject("ADODB.Recordset"
rsChildDropDown.ActiveConnection = MM_connChildParent_STRING
rsChildDropDown.Source = "SELECT * FROM child_table WHERE grouptype = '" + Request.Form("myParent" + "'"
rsChildDropDown.CursorType = 0
rsChildDropDown.CursorLocation = 2
rsChildDropDown.LockType = 3
rsChildDropDown.Open()
rsChildDropDown_numRows = 0
%>
but grouptype is a numeric field in my database, so that's why it won't work
now i will get the query
select * from child_table where grouptype = '1' and that won't work
how do i get
where grouptype = 1 ?
because when i change this :
rsChildDropDown.Source = "SELECT * FROM child_table WHERE grouptype = '" + Request.Form("myParent" + "'"
to this :
rsChildDropDown.Source = "SELECT * FROM child_table WHERE grouptype = " + Request.Form("myParent" then i will get some error about missing operators
can someone please help?