Shortcuts

Query problem - returns no details.

There is a problem with my selectcommand. It returns all the forums, not just the news ones. I triend to use Dinstinct but it didnt make a difference. The objective is to pull everything from the forum table that have the same Category (ForumName) but
it is pulling ecerything in the forums table not just the ones with the session variable "news" or the date. Can I have some help with that. Here is the current code.

Re: Query problem - returns no details.

I dont know where the @News and @Date fit in. Let me re-ellaborate. There are two session variables. @dete and @Category. @Category(eg Value= "News"), is a column in the Menu Table, and is there to compare that the data in the forum table and retrieve everything
in the forum Table based on the Category value(eg.News), or MenuName from the Menu Table(The value "News" is a MenuName column in the Menu table). In addition to that we want to pull the ThreadTitle in the Thread Table that matches the specified ForumID with
the Forum Name Value is @Category(eg. News). It is also supposed to pull the Last PostTime that matches the session variable @dete, and UserName of the last Post, of the specified thread, of the specified forum, of the specified MenuName(eg. "News")

Re: Query problem - returns no details.

Sorry, was giving more of a theory than exact details. So for the dates, I presume that would be your @Dete (referred to as @Date) and the menuname would be @Category (this was that @News I referred to).

Re: Query problem - returns no details.

One thing I would really recommend you do is instead of referring to a unique identifier, why aren't you using an Integer for UserId? This could make your database fat which could make things sluggish.

(Hyperlink)hplThread(counter).Text = (Latest) Td.ThreadName(counter) where
Td.ThreadDate=@dete and Td.ForumId=Fm.ForumId and Fm.MenuId=Mn.MenuId and Mn.MenuName= @Category
(Hyperlink)hplThreadUser(counter).Text = (Latest) Td.UserId(counter) where Td.UserId = Users.UserId and Td.ThreadId=Fm.ThreadId and
Td.ThreadDate=@dete and Fm.MenuId=Mn.MenuId and Mn.MenuName= @Category
lblDatePosted= Td.ThreadDate(counter) where and
Td.ThreadDate=@dete and Td.IsApproved= true and Td.ThreadId=Fm.ThreadId and Fm.MenuId=Mn.MenuId and Mn.MenuName= @Category
lblTime(counter).Text = (Latest)Pt.PostTime(counter) where Pt.IsApproved=true and Pt.PostId = Td.PostId and Td.ThreadId=Fm.ThreadId and Fm.MenuId=Mn.MenuId and Mn.MenuName= @Category

Thread Page

Session["Room"] = "World News"
Session["det"] = 3/4/2012

lblRoomDesc.Text = Fm.ForumDesc where Fm.ForumName = @Room

These controls are based on a counter because there are more than one of them, ten of them each set in a div.

Re: Query problem - returns no details.

I knew you'd run into the # problem because you are most likely running sql server. So instead of surrounding the date with #, use quote marks. Again, I only did that as an example to show where your query may have had some problems.

Re: Query problem - returns no details.

I am still getting no data, only column names. And of the columns the only ones showing up is ForumId, MenuId, ForumName and ForumDesc. I remember working on a project in Visual Studio 2007 and I had to change the build (I am running a 64 bit pc). Do you
think thats the problem? Either way the columns I am trying to get are not all showing up and there is no data. I'd really appreciate it if you took a look at the page breakdown I posted. I'd really appreciate it bbcompent1.

Re: Query problem - returns no details.

I tend to think it has more to do with your queries than the database. I'm going to look back over this thread and try taking what you have said into account to provide you wiht the queries that will help get you off to the right start.

Re: Query problem - returns no details.

bbcompent1

I tend to think it has more to do with your queries than the database. I'm going to look back over this thread and try taking what you have said into account to provide you wiht the queries that will help get you off to the right start.

Please dont forget to incorporate the IsApproved for both the Threads and Posts. Again Thank You.

Re: Query problem - returns no details.

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.

Re: Query problem - returns no details.

Code_warriors

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.

Re: Query problem - returns no details.

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.

Re: Query problem - returns no details.

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.

Re: Query problem - returns no details.

Re: Query problem - returns no details.

It does work for the forums that dont have any populated threads or posts. But it still does not work for the one forum that is populated. It lists the threadname, UserId and Postime for the forum even though I change the dates several times. And even that
only works when I use a OR not an AND in the WHERE statement. Again the code is