@Category isn't a table so it doesn't know how to relate that properly. Try your query like this to see if you get something and then if you get results, we will debug this Menu table.
SELECT * FROM Forum Fm, Menu Mn
LEFT JOIN Thread Td ON Td.ForumId = Fm.ForumId
LEFT JOIN Post Pt ON Pt.ThreadId = Td.ThreadId and Pt.PostTime = @dete
WHERE Fm.ForumName = @Category AND Md.Menuname = @Category AND Pt.PostTime = @dete
SELECT * FROM Forum Fm, Menu Mn
LEFT JOIN Thread Td ON Td.ForumId = Fm.ForumId
LEFT JOIN Post Pt ON Pt.ThreadId = Td.ThreadId
AND Pt.PostTime = @dete
WHERE Fm.ForumName = @Category
AND Mn.Menuname = @Category
AND Pt.PostTime = @dete
SELECT * FROM Forum Fm, Menu Mn LEFT JOIN Thread Td ON Td.ForumId = Fm.ForumId LEFT JOIN Post Pt ON Pt.ThreadId = Td.ThreadId AND Pt.PostTime = @dete WHERE Fm.ForumName = @Category AND Mn.Menuname = @Category AND Pt.PostTime = @dete
Error message: The multi-part identifier "Fm.ForumId" could not be bound
Again, the error msg in the query tester for the sqldatasource is
Error message: The multi-part identifier "Fm.ForumId" could not be bound
the query is
SELECT * FROM Forum Fm, Menu Mn
LEFT JOIN Thread Td ON Td.ForumId = Fm.ForumId
LEFT JOIN Post Pt ON Pt.ThreadId = Td.ThreadId
AND Pt.PostTime = @dete
WHERE Fm.ForumName = @Category
AND Mn.MenuName = @Category
AND Pt.PostTime = @dete
Table structure
Users (UserId)
Menu (MenuId, MenuName, MenuDesc)
Forum (ForumId, MenuId, ForumName, ForumDesc)
Thread (ThreadId, ForumId, ThreadTitle,ThreadText, UserId, ThreadDate)
Post (PostId, ThreadId, PostText, PostDate, UserId)
The objective is to pull information necessary to populate
1. The forum Page (Menu, Forum, Thread, Post Table Data, where Forum.MenuId = Session["Category"] and (Last) Post.PostDate = Session ["dete"]),
bbcompent1
All-Star
33097 Points
8529 Posts
Moderator
Re: Query problem - returns no details.
Apr 05, 2012 01:37 PM|LINK
This join right here seems to be the problem:
LEFT JOIN Menu Mn ON Mn.MenuName =@Category
@Category isn't a table so it doesn't know how to relate that properly. Try your query like this to see if you get something and then if you get results, we will debug this Menu table.
SELECT * FROM Forum Fm, Menu Mn
LEFT JOIN Thread Td ON Td.ForumId = Fm.ForumId
LEFT JOIN Post Pt ON Pt.ThreadId = Td.ThreadId and Pt.PostTime = @dete
WHERE Fm.ForumName = @Category AND Md.Menuname = @Category AND Pt.PostTime = @dete
bbcompent1
All-Star
33097 Points
8529 Posts
Moderator
Re: Query problem - returns no details.
Apr 05, 2012 01:40 PM|LINK
Sorry, mistyped:
basheerkal
Star
10672 Points
2426 Posts
Re: Query problem - returns no details.
Apr 05, 2012 02:25 PM|LINK
Then why do you combine them?
Write 3 separate simple quries for each Datasource in each page.
First you do it on Forum page.
(Talk less..Work more)
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 05, 2012 07:22 PM|LINK
I dont intend to combine them on one page. I am just trying to get some help on each query for each datasource.
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 05, 2012 07:38 PM|LINK
Error message: The multi-part identifier "Fm.ForumId" could not be bound
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 05, 2012 08:44 PM|LINK
I dont understand why its not producing any data. The query seems sound.
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 06, 2012 12:32 AM|LINK
Again, the error msg in the query tester for the sqldatasource is
Error message: The multi-part identifier "Fm.ForumId" could not be bound
the query is
Table structure
Users (UserId)
Menu (MenuId, MenuName, MenuDesc)
Forum (ForumId, MenuId, ForumName, ForumDesc)
Thread (ThreadId, ForumId, ThreadTitle,ThreadText, UserId, ThreadDate)
Post (PostId, ThreadId, PostText, PostDate, UserId)
The objective is to pull information necessary to populate
1. The forum Page (Menu, Forum, Thread, Post Table Data, where Forum.MenuId = Session["Category"] and (Last) Post.PostDate = Session ["dete"]),
bbcompent1
All-Star
33097 Points
8529 Posts
Moderator
Re: Query problem - returns no details.
Apr 06, 2012 11:47 AM|LINK
Could you post a few rows from each table so I can emulate your tables here? Then I'll be able to better work on this problem.
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 06, 2012 05:04 PM|LINK
MenuId varchar(50) MenuName varchar(50) MenuDesc nvarchar(MAX)
1
ForumId varchar(50) MenuId nvarchar(50) ForumName varchar(50) ForumDesc varchar(MAX)
ThreadId varchar(50) ForumId varchar(50) UserId varchar(50) ThreadName varchar(50) Views varchar(50) ThreadText varchar(150) IsApproved bit ThreadTime date
PostId varchar(50) ThreadId varchar(50) PostTime datetime PostApproved bit PostText varchar(150) UserId uniqueidentifier
UserId uniqueidentifier
f8a61143-a418-4dfe-8a82-e83a2e756abe
bbcompent1
All-Star
33097 Points
8529 Posts
Moderator
Re: Query problem - returns no details.
Apr 06, 2012 05:05 PM|LINK
Ok, now how do you want this data to look exactly in each gridview?