Alright, what you're going to want to do in this case is use the query designer. Start first by doing a super simple query and see if you get anything from the database. If you do, then next thing to do is add a condition to the query like:
where dete = @dete AND isApproved = true
If that works, then we add another variable to the mix, namely Category:
where Category = @Category AND dete = @dete AND isApproved = true;
Since your boss is being tough about allowing you to show more details, this is the best I can do under the circumstances. If those queries return values, then we can try doing some more refinement.
These controls are based on counters because there are ten of them(each set in a div)
This will not work. We can't combine SQL code with setting labels. You write your query and then based on the results it sends back to you, you display that. I would recommend instead of using DIVs use databound controls like gridview or repeater. All you're
going to do by writing your code this way is frustrate yourself. Use tried and true methods.
Looking at all the Data Views, It would seem a DetailsView is what I need but correct me if I am wrong. The question is can you split a DetailsView into two columns and do I need to put ten of them on the page or am I only to put one and they would repeat
themselves.
Well, alot depends on what the interface is going to do. Are you just listing information and links or are you looking to actually edit the info in the database?
The problem is with the querystriing. I have the one below but the problem is that it pulls the right ForumName and ForumDesc but the rest are filled in. What I mean is that only one forum(first one) is populated witha thread row. The rest are empty but
for some reason it is taking the one thread populated and filling the forum rows with it. There shouldnt be anything in the ThreadName for the rest of the rows except for the first one.
SELECT Fm.ForumName, Fm.ForumDesc, Td.ThreadName, Td.UserId, Pt.PostTime FROM Menu Mn, Forum Fm, Thread Td, Post Pt,aspnet_Users Us WHERE Mn.MenuId = Fm.MenuId AND Td.ThreadId = Pt.ThreadId AND Pt.UserId = Us.UserId AND Mn.MenuName = @Forum OR Td.ThreadTime = @dete
SELECT Forum.ForumName, Forum.ForumDesc, Thread.ThreadName, aspnet_Users.UserName, Post.PostTime
FROM aspnet_Users INNER JOIN
Post ON aspnet_Users.UserId = Post.UserId INNER JOIN
Thread ON Post.ThreadId = Thread.ThreadId INNER JOIN
Forum ON Thread.ForumId = Forum.ForumId INNER JOIN
Menu ON Forum.MenuId = Menu.MenuId
WHERE (Menu.MenuName = @Forum)OR
(Thread.ThreadTime = @dete)
This one gives me just one row, the one that is populated, but I want it to show the forums(rows) that are not populated as well. Please help.
bbcompent1
All-Star
32980 Points
8503 Posts
Moderator
Re: Query problem - returns no details.
Apr 11, 2012 11:01 AM|LINK
Yes, I've been waiting for you to respond to the private message I sent you.
bbcompent1
All-Star
32980 Points
8503 Posts
Moderator
Re: Query problem - returns no details.
Apr 11, 2012 11:16 AM|LINK
Alright, what you're going to want to do in this case is use the query designer. Start first by doing a super simple query and see if you get anything from the database. If you do, then next thing to do is add a condition to the query like:
where dete = @dete AND isApproved = true
If that works, then we add another variable to the mix, namely Category:
where Category = @Category AND dete = @dete AND isApproved = true;
Since your boss is being tough about allowing you to show more details, this is the best I can do under the circumstances. If those queries return values, then we can try doing some more refinement.
bbcompent1
All-Star
32980 Points
8503 Posts
Moderator
Re: Query problem - returns no details.
Apr 11, 2012 11:20 AM|LINK
This will not work. We can't combine SQL code with setting labels. You write your query and then based on the results it sends back to you, you display that. I would recommend instead of using DIVs use databound controls like gridview or repeater. All you're going to do by writing your code this way is frustrate yourself. Use tried and true methods.
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 12, 2012 01:14 AM|LINK
Looking at all the Data Views, It would seem a DetailsView is what I need but correct me if I am wrong. The question is can you split a DetailsView into two columns and do I need to put ten of them on the page or am I only to put one and they would repeat themselves.
bbcompent1
All-Star
32980 Points
8503 Posts
Moderator
Re: Query problem - returns no details.
Apr 12, 2012 10:07 AM|LINK
Well, alot depends on what the interface is going to do. Are you just listing information and links or are you looking to actually edit the info in the database?
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 13, 2012 02:38 AM|LINK
Just to display the info and link some of them to other pages.
bbcompent1
All-Star
32980 Points
8503 Posts
Moderator
Re: Query problem - returns no details.
Apr 13, 2012 02:08 PM|LINK
Make it easier on yourself and do this with GridViews. The capability is built into the gridview control without having to recode everything.
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 16, 2012 06:32 AM|LINK
The problem is with the querystriing. I have the one below but the problem is that it pulls the right ForumName and ForumDesc but the rest are filled in. What I mean is that only one forum(first one) is populated witha thread row. The rest are empty but for some reason it is taking the one thread populated and filling the forum rows with it. There shouldnt be anything in the ThreadName for the rest of the rows except for the first one.
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 17, 2012 05:20 AM|LINK
SELECT Forum.ForumName, Forum.ForumDesc, Thread.ThreadName, aspnet_Users.UserName, Post.PostTime FROM aspnet_Users INNER JOIN Post ON aspnet_Users.UserId = Post.UserId INNER JOIN Thread ON Post.ThreadId = Thread.ThreadId INNER JOIN Forum ON Thread.ForumId = Forum.ForumId INNER JOIN Menu ON Forum.MenuId = Menu.MenuId WHERE (Menu.MenuName = @Forum)OR (Thread.ThreadTime = @dete)This one gives me just one row, the one that is populated, but I want it to show the forums(rows) that are not populated as well. Please help.
Code_warrior...
Member
251 Points
282 Posts
Re: Query problem - returns no details.
Apr 17, 2012 06:32 PM|LINK
Anyone have any ideas? PLease help.