Forums

This topic is locked

sql IN operator problems

Posted 11 Apr 2005 21:42:54
1
has voted
11 Apr 2005 21:42:54 summer westbrook posted:
**apologies first - i accidentally posted this first time in the wrong forum**

Any ideas what's wrong with this?
I am getting syntax errors.
(.asp pages, Windows 2k)


Dim rsCatagories
Dim rsCatagories_numRows

Set rsCatagories = Server.CreateObject("ADODB.Recordset"
rsCatagories.ActiveConnection = MM_ssoteaminfo_STRING
rsCatagories.Source = "SELECT * FROM dbo.ctlSupportFormCatagories WHERE CatagoryNumber IN '" & Replace(rsCatagories__MMColParam, ",", "','" & "' ORDER BY CatagoryNumber ASC"
rsCatagories.CursorType = 0
rsCatagories.CursorLocation = 2
rsCatagories.LockType = 1
rsCatagories.Open()

rsCatagories_numRows = 0


Where the variable contains either a single character (like A) or a string (like A, B, C).

Thanks!

Edited by - slw123 on 11 Apr 2005 21:45:36

Replies

Replied 12 Apr 2005 00:45:04
12 Apr 2005 00:45:04 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>... WHERE CatagoryNumber IN '" & Replace(rsCatagories__MMColParam, ",", "','" ...<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Maybe adding parathesis () around the IN value strings. Example:
<pre id=code><font face=courier size=2 id=code>"... IN ('" & Replace(rsCatagories__MMColParam, ",", "','" & "') ..."</font id=code></pre id=code>

~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
Replied 12 Apr 2005 17:36:07
12 Apr 2005 17:36:07 summer westbrook replied:
Thanks!
At least that fixed the syntax error...

But its only returning the first record as indicated by the string. (ex: string 'B','D','F' only returns record B).

I have a repeated region, but only the single record...

Reply to this topic