navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

DRW within a DRW

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> DRW within a DRW
Page: [1]
 
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
DRW within a DRW - 9/4/2002 20:08:10   
What if I need to place a DRW within a DRW??
no_mac_jack

 

Posts: 295
From: Washington state, USA
Status: offline

 
RE: DRW within a DRW - 9/4/2002 20:33:06   
I think we went over this recently, but I don' t remember where.

Anyway, it can' t be done because you will need to be using the same variables (in the FP includes) for both DRW regions which obviously causes a conflict.

Depending on your situation, though, there' s probably a way around it. Remember that a DRW region can be used to store information for use later in the page without displaying the data immediately. Maybe if you explain the situation we can come up with a way around it.

~no_mac_jack

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/4/2002 20:39:13   
Okay on my site I have to databases - one that houses articles, and one that houses comments about the articles.

The articles are displayed in a DWR on a page. I would also like to say how many comments for the article which is displayed on screen.

The articles are displayed in LISTS of 20 per page and in each returned record I wish display the number of comments.


THanks

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/5/2002 0:09:12   
Hi Lydecker,

Do you mean by two databases, two tables?

If yes you can create a Join query instead of creating two DRW.

Do both tables have a PK and FK?


Regards
Hisham

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/5/2002 0:24:58   
Hi Lydecker,

If you have two tables related by one field you can type the following sql in the custom query.

SELECT articles.ArticleID, articles.Title, articles.Author, Count(comments.Comments) AS CountOfComments
FROM articles INNER JOIN comments ON articles.ArticleID=comments.ArticleID
GROUP BY articles.ArticleID, articles.Title, articles.Author;


OR


Create a join query in Access itself, save it, import the database to your web, insert a DRW and make the record source to be the Access Query itself as I did in my example below.

http://www.fmhs.uaeu.ac.ae/nml/Articles.asp

I hope that you find this useful

Best regards
Hisham

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/5/2002 8:13:49   
so I really need to place them both in the same DataBase first.... correct? (but different tables)

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/5/2002 8:16:27   
Hi lydecker,

Yes, in the same database and in different tables. It will work fine.

Did you check the test page I setup for you?

Regards
Hisham

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/5/2002 8:56:02   
Okay everyting is in one DB now. 2 Tables - 1 called ' Comments' the second called ' Results' .

In each returened record I wish to display the following:

From the Results Table
Date
Message
Picture
Name
Tiltle
ID

From the Comments Table
The number of comments for each ID value (i.e total up same ID values)

I guess a SQL query in Access is best. Thanks for the example, but you have left the Access SQL off :(

Thanks

< Message edited by Lydecker -- 9/4/2002 9:17:31 AM >

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/5/2002 11:20:26   
Hi lydecker,


I left the SQL on the top of the second questions.


But also Access query will work.

Is it done now?


Regards
Hisham

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/6/2002 8:49:58   
I' m affraid it doesnt work. Here is the code I am using:

SELECT Table1.ID, Table1.title, Table1.author, Count(comments.ID1) AS CountOfComments
FROM Table1 INNER JOIN comments ON Table1.ID=comments.ID1
GROUP BY Table1.ID, Table1.Title, Table1.author;

(in reply to Lydecker)
Cookie

 

Posts: 297
Joined: 2/7/2002
From: UK
Status: offline

 
RE: DRW within a DRW - 9/6/2002 8:56:12   
Hi,

I recently posted about creating a DRW within a DRW, and in the end I decided to just create the DRW in different cells. They dont overlap and I have a bout 4 DRW running on 1 page, and it works fine.

Dave

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/6/2002 8:59:12   
Hi Lydecker,

Is ID1 a FK in the second table and ID is the PK of the first table?

I prefer that the PK and FK to be the same name.

Look at my example, this code is working fine.

Regards
Hisham

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/6/2002 9:10:27   
Hi Lydecker,


:)

Attachment (1)

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/6/2002 9:12:27   
What does FK stand for?

It is not possible for the two to have the same name :)

Thanks

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/6/2002 9:18:03   
Oh - I' m getting somewhere. I changed the ID1 field to a ' number' value insctead of a ' text' one.

I have to dash for lunch - I' ll experiment more when I get back, Thanks!!

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/6/2002 9:20:26   
Hi Zac,

Table Articles has: ArticleID as Primary Key (PK)
Table Comments has: ArticleID as Foriegn Key (FK)
Articles table is related to Comments table via ArticleID



:)

Attachment (1)

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/6/2002 9:40:47   
okay I have the primary key set in Table1, but don' t know how to set a forign key in the Comments Table:)

Thanks

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/6/2002 9:45:22   
Okay - all working - just one problem!

If there are NO comments for a certain ID then no records are returned from the Table1 table.

If there are no comments for an ID then I wish the Table1 results still to be displayed, but with ' 0' in the ' CountOfComments' field instead of nothing returned. Follow?

Thanks

(ps my current code is:

SELECT Table1.ID, Table1.picture, Table1.news, Table1.eventone, Table1.eventtwo, Table1.title, Table1.author, Count(comments.ID1) AS CountOfComments
FROM Table1 INNER JOIN comments ON Table1.ID=comments.ID1
GROUP BY Table1.ID, Table1.Title, Table1.author, Table1.eventtwo, Table1.eventone, Table1.news, Table1.picture;

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/6/2002 9:46:58   
Hi,

In Article Table Click on ArticleID and then make it rimary Key
IN Comments table insert a field, call it ArticleID. Then Go to Relationships, Insert both tables, then Drage the ArticleID field from Article Tables and release it over the ArticleID in the Comments table, then press OK.

Don' t set any referrential integrity.

See my previous reply where I copied the relationships page for you.

Regards
Hisham

< Message edited by hhammash -- 9/5/2002 9:48:30 AM >

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/6/2002 9:59:10   
THanks fo r that - now just the problem in my previous post remains.

Thank You

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/6/2002 13:42:38   
Hi Lydecker,

What are you doing to know if there is a comment or no. I mean when you fill in the table in Access what do you type in the column (comments) do you type the comment itself or you put a number?

Hisham

< Message edited by hhammash -- 9/5/2002 1:44:53 PM >

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/6/2002 13:54:57   
Hi Lydecker,

Look at my link again and see if this is what you want. If yes look below


1- Comments field in Access Database should be " Text" field not number.
2- If there is no comment keep it blank
3- In the Custom Query in Frontpage insert

SELECT DISTINCT articles.ArticleID, articles.Title, articles.Author, Count(comments.Comments) AS CountOfComments
FROM articles INNER JOIN comments ON articles.ArticleID = comments.ArticleID
GROUP BY articles.ArticleID, articles.Title, articles.Author;


Hope it works for you
Hisham

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/6/2002 14:03:10   
The comments table is different to the article table. Just because someone submits data to the article table DOES NOT mean that they will submit any data to the comments table (follow?).

If you wish I can send you the db so you can see my db layout.

Thanks for the help[:p]

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/6/2002 15:59:40   
Hi Lydecker,

Would love too.

Email it to: hhammash@emirates.net.ae

Regards
Hisham

(in reply to Lydecker)
Lydecker

 

Posts: 609
From: Oxshott, Surrey, England (UK)
Status: offline

 
RE: DRW within a DRW - 9/6/2002 18:33:37   
It should be in your inbox:)

Thank you Hisham

(in reply to Lydecker)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: DRW within a DRW - 9/6/2002 19:35:49   
Hi Lydecker,

Add another field and call it CommentSubject
Because we can not count the memo field, then this is the sql code:

SELECT Table1.ID, Table1.author, Table1.Title, Count(Comments.CommentSubject) AS CountOfCommentSubject
FROM Table1 LEFT JOIN Comments ON Table1.ID = Comments.ID1
GROUP BY Table1.ID, Table1.author, Table1.Title;

Left Join will take all fields from Table1 and all matching fields from Table2.

Note: Table1 should not have any Article ID that is not available in Table1, since ID is the primary key, otherwise the count will not appear.

In the database you sent, there was article ID 260 in comments which is not available in Table1.

Regards
Hisham

(in reply to Lydecker)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> DRW within a DRW
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts