Author |
Topic |
AnonJr
Moderator
United States
5768 Posts |
Posted - 17 September 2005 : 14:28:49
|
I think this should do it... we just need to consolodate a little code...
you see this above the actual connection:
'############################## Group Cat MoD #####################################
if Cat_ID <> "" then
strSql = strSql & " WHERE F.CAT_ID = " & Cat_ID
else
if Group > 1 and strGroupCategories = "1" then
strSql = strSql & " WHERE F.CAT_ID = 0"
if recGroupCatCount <> "" then
for iGroupCat = 0 to recGroupCatCount
strSql = strSql & " OR F.CAT_ID = " & allGroupCatData(1, iGroupCat)
next
end if
end if
end if
'############################## Group Cat MoD #####################################
if Cat_ID <> "" then
strSql = strSql & " AND F_PARENT IS NULL"
else
strSql = strSql & " WHERE F_PARENT IS NULL"
end if
strSql = strSql & " ORDER BY F.F_ORDER ASC, F.F_SUBJECT ASC;"
We just need to change it all to:
'############################## Group Cat MoD #####################################
if Cat_ID <> "" then
strSql = strSql & " WHERE F.CAT_ID = " & Cat_ID & " AND F.F_PARENT IS NULL"
else
if Group > 1 and strGroupCategories = "1" then
strSql = strSql & " WHERE F.F_PARENT IS NULL AND F.CAT_ID = 0"
if recGroupCatCount <> "" then
for iGroupCat = 0 to recGroupCatCount
strSql = strSql & " OR F.CAT_ID = " & allGroupCatData(1, iGroupCat)
next
end if
end if
end if
'############################## Group Cat MoD #####################################
strSql = strSql & " ORDER BY F.F_ORDER ASC, F.F_SUBJECT ASC;" That should stop the extra "WHERE" from appearing... just keep in mind this isn't tested, and as always - backup!
Let me know if it works.< |
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 17 September 2005 : 14:36:07
|
In retrospect, it could have been simpler to change:
if Cat_ID <> "" then
strSql = strSql & " AND F_PARENT IS NULL"
else
strSql = strSql & " WHERE F_PARENT IS NULL"
end if
strSql = strSql & " ORDER BY F.F_ORDER ASC, F.F_SUBJECT ASC;" To:
strSql = strSql & " AND F.F_PARENT IS NULL ORDER BY F.F_ORDER ASC, F.F_SUBJECT ASC;"
But hind-sight is always 20/20
(ed. for typeo - ie lack of coffee)< |
Edited by - AnonJr on 17 September 2005 14:37:24 |
|
|
ElPazzo
Junior Member
Austria
116 Posts |
Posted - 17 September 2005 : 14:45:37
|
forum now itself works... when i try to edit forum properties i get this:
Microsoft OLE DB Provider for ODBC Drivers Fehler "80040e14'
[MySQL][ODBC 3.51 Driver][mysqld-4.0.24_Debian-10]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '1 F_PARENT FROM FORUM_FORUM WHERE FORUM_ID = '12'' at line 1
/forum/post.asp, line 648
here a link to txt file:
http://www.pet-needs.com/forum/post.txt< |
www.pet-needs.com www.pet-needs.com/forum www.pet-needs.de www.translating-it.com |
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 17 September 2005 : 14:48:56
|
Its the ' in the WHERE part of the statement. I had to remove a few of those... If the datatype is numerical, you can't have the ' around it. You'll need to fix that in a few other SQL statements.< |
|
|
ElPazzo
Junior Member
Austria
116 Posts |
Posted - 17 September 2005 : 15:14:03
|
changed the string to this:
strSQL = "SELECT TOP 1 F_PARENT FROM FORUM_FORUM WHERE FORUM_ID = " & strRqForumID & " "
but still get the same error< |
www.pet-needs.com www.pet-needs.com/forum www.pet-needs.de www.translating-it.com |
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 17 September 2005 : 15:40:13
|
Drop the trailing space too. It should look like:
strSQL = "SELECT TOP 1 F_PARENT FROM FORUM_FORUM WHERE FORUM_ID = " & strRqForumID
(I tell ya, I have definatly gotten better with my SQL working with these forums... )< |
|
|
ElPazzo
Junior Member
Austria
116 Posts |
Posted - 17 September 2005 : 15:54:43
|
what do you mean by trailing space?
inserting your string instead of mine does not work, it tells me the string is incomplete< |
www.pet-needs.com www.pet-needs.com/forum www.pet-needs.de www.translating-it.com |
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 17 September 2005 : 22:02:42
|
In:
strSQL = "SELECT TOP 1 F_PARENT FROM FORUM_FORUM WHERE FORUM_ID = " & strRqForumID & " "
the part in red is the trailing space.
What is the exact error?< |
|
|
muzishun
Senior Member
United States
1079 Posts |
Posted - 17 September 2005 : 22:53:22
|
Try ending the SQL statement with a semicolon. With or without the trailing space, the statment isn't completed until it's terminated. Try this:
strSQL = "SELECT TOP 1 F_PARENT FROM FORUM_FORUM WHERE FORUM_ID = " & strRqForumID & ";"< |
Bill Parrott Senior Web Programmer, University of Kansas Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com) Personal Website (www.chimericdream.com) |
|
|
sr_erick
Senior Member
USA
1318 Posts |
Posted - 17 September 2005 : 23:18:50
|
If you are using MySQL you must use LIMIT instead of TOP.
strSQL = "SELECT F_PARENT FROM FORUM_FORUM WHERE FORUM_ID = " & strRqForumID & " LIMIT 1;"
Hopefully you get it working without running into too many more problems.< |
Erick Snowmobile Fanatics
|
Edited by - sr_erick on 17 September 2005 23:23:35 |
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 17 September 2005 : 23:55:45
|
quote: Originally posted by sr_erick
If you are using MySQL you must use LIMIT instead of TOP.
Ah ha! Drat that Microsoft!
I'll have to file this.< |
|
|
sr_erick
Senior Member
USA
1318 Posts |
Posted - 18 September 2005 : 00:41:34
|
quote: Originally posted by AnonJr
Ah ha! Drat that Microsoft!
I'll have to file this.
No, it's just a real DBMS. < |
Erick Snowmobile Fanatics
|
|
|
ElPazzo
Junior Member
Austria
116 Posts |
Posted - 18 September 2005 : 05:25:42
|
it was the mysql prob...
but how do i add a subforum now?< |
www.pet-needs.com www.pet-needs.com/forum www.pet-needs.de www.translating-it.com |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
|
ElPazzo
Junior Member
Austria
116 Posts |
Posted - 18 September 2005 : 06:10:51
|
thx < |
www.pet-needs.com www.pet-needs.com/forum www.pet-needs.de www.translating-it.com |
|
|
Topic |
|