Rexolio
Technical User
- Aug 29, 2001
- 230
Sorry about the subject...didn't know a better way to describe it!
I have a database with 2 tables. One table contains different categories. The second table contains registered members info.
I have 45 categories and didn't want 45 fields in my members table. SO, in the member's table I have a field called "CategoryIDs". When someone has mulitple categories, they're listed in the field like " 4, 6, 10, 15,". I have the last number added with a comma behind it as well so that I'd have some type of separator.
What I need to do on my ASP is to have the members info displayed including the actual names of the categories.
I tried this, but does not work (I know I'm horrible at this stuff - I'm sure its a butchered way to do this!)...
<%
CatID = CategoryIDs
'BEGIN LISTING CATEGORIES
CatID = Replace(CatID," ",""
stID = LCase(Trim(CatID))
aryID = Split(stID,","
For i = 0 To UBound(aryID)
sID = aryID(i)
SQL="SELECT * FROM tblCategories WHERE CategoryID = " & sID
Set List=cnSupport.execute(SQL)
do while not List.eof
Response.write List("Category" & ", "
List.movenext
loop
List.close
'FIND NEXT CATEGORY
Next
%>
which results in the following error...
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '='.
list.asp, line 178
Line 178 is this line from above:
SQL="SELECT * FROM tblCategories WHERE CategoryID = " & sID
can anyone straighten me out?
I have a database with 2 tables. One table contains different categories. The second table contains registered members info.
I have 45 categories and didn't want 45 fields in my members table. SO, in the member's table I have a field called "CategoryIDs". When someone has mulitple categories, they're listed in the field like " 4, 6, 10, 15,". I have the last number added with a comma behind it as well so that I'd have some type of separator.
What I need to do on my ASP is to have the members info displayed including the actual names of the categories.
I tried this, but does not work (I know I'm horrible at this stuff - I'm sure its a butchered way to do this!)...
<%
CatID = CategoryIDs
'BEGIN LISTING CATEGORIES
CatID = Replace(CatID," ",""
stID = LCase(Trim(CatID))
aryID = Split(stID,","
For i = 0 To UBound(aryID)
sID = aryID(i)
SQL="SELECT * FROM tblCategories WHERE CategoryID = " & sID
Set List=cnSupport.execute(SQL)
do while not List.eof
Response.write List("Category" & ", "
List.movenext
loop
List.close
'FIND NEXT CATEGORY
Next
%>
which results in the following error...
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '='.
list.asp, line 178
Line 178 is this line from above:
SQL="SELECT * FROM tblCategories WHERE CategoryID = " & sID
can anyone straighten me out?