?
Solved

Working with DBGIRD

Posted on 2003-02-23
12
Medium Priority
?
163 Views
Last Modified: 2010-04-04
Hi experts,
I was created a database that store the article fields or ….
This article(entity) has a field that has more than one value(I called keyword).
The relation between  article and keyword(in my idea) is m:n .
Finally , I design two tables, one article and other, keywords as below;
1-     article(ID, title,descript,index,abstract).  ID= primary key
2-     keywords (id,keyword). ID+keyword=primary key , ID=forign key
do any work that implement these two tables with one dbgird that show the real field of article and another field
( example keywords) when user click on this field the values of the field will show(the delete,add and modify available for values) ?


thanks a lot
hamid reza

0
Comment
Question by:123456
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
12 Comments
 
LVL 1

Expert Comment

by:keashF
ID: 8006770
you can make a lookup for this. here's how to do it:
* double click on your article Table component (not the DBGrid)
* you'll get a small window where you can add fields you wish to show
* right click and add the fields7
* now it's getting intersting: right click again and choose "new field"
* choose the datatype and name (propably string and "keyword") and select "lookup" for field type.
* using the rest of the comboboxes you can link your table to the keywords table using id, like this:
keyfield=id, datadset=your_keyword_sdataset, lookupkeys=id,
result=keywords

cu
keashF
0
 

Expert Comment

by:Brcko
ID: 8007803
exactly the relation is 1:n

for editing you must use master detail view. there are few dbgrid components, that can do this, but they aren't free
(b.e. Quantum Grid)

From my point of view, with standard dbgrid you can't do this (of course, you can do everything, but not easily)
0
 
LVL 2

Author Comment

by:123456
ID: 8008052
bracko,
may be one keyword exist in more than one article ( for it M:N);

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Author Comment

by:123456
ID: 8008062
keashf,
I do your comment but I don’t modify, delete & add values.
pay attention to my question  again
do any work that implement these two tables with one dbgird that show the real field of article and another field
( example keywords) when user click on this field the values of the field will show(pay attentionà the delete,add and modify available for values) ?

regards
hamid reza
0
 
LVL 1

Expert Comment

by:keashF
ID: 8008963
then i don't understand your question, i'm sorry
0
 

Expert Comment

by:Brcko
ID: 8008969
not,
I'm right
for every record in keywords exist exactly one record in articles (ID is foreign key)
a keyword can be in more articles, but it is not same record in table keywords

thus this is relation 1:n

for relation m:n should diagram be

table article
article_id,name,text,...

table keyword
keyword_id,keyword

table article_keyword
article_id (foreign key to articles)
keyword_id (foreign key to keywords)

that means for every article exists 0..n keywords
and every keyword is in 0..n articles

but not about that was question.

to your question, as I wrote upper
it is not possible in ONE simple DBgrid (like shipped with Delphi) display or (work with) master-detail (1:n,m:n) relationship
but try look at Quantum Grid from DevExpress, that component had ability for displaying, editing, ... master-detail records
0
 
LVL 2

Author Comment

by:123456
ID: 8009533
I don’t accept your idea,
Why?
because keyword not a independence entity .
In my idea one article can has more than one keyword and a keyword can use in more than one article.
For it,I  restricted more than one field for primary key in keyword table(id+keyword).
Im my idea the relationship is m:n .
Because I don’t accept the keyword as individul entity, I don’t restricted any indepent table for it.
That you say in your example about m:n.

But about quantum grid component ,is this component is free?
 I find a QgridFeaturesDemo.exe  file in my computer ,but I think it s for advertising.
Can I use of this file in my project!?

Regards
Hamid reza

0
 
LVL 2

Author Comment

by:123456
ID: 8009590
I don’t accept your idea,
Why?
because keyword not a independence entity .
In my idea one article can has more than one keyword and a keyword can use in more than one article.
For it,I  restricted more than one field for primary key in keyword table(id+keyword).
Im my idea the relationship is m:n .
Because I don’t accept the keyword as individul entity, I don’t restricted any indepent table for it.
That you say in your example about m:n.

But about quantum grid component ,is this component is free?
 I find a QgridFeaturesDemo.exe  file in my computer ,but I think it s for advertising.
Can I use of this file in my project!?

Regards
Hamid reza

0
 

Expert Comment

by:Brcko
ID: 8009869
in your system keyword is not usable in more than one article coz every record from keywords has ID which is foreign key into articles

you got 2 fields in primary key of table keywords
article id,keyword
only thing, that this is for is that you can't have two same keywords in one article

your data are
tbl article
============================
id,name,text
============================
1,name1,text 1 with key_word
2,name2,text 2 with key_word

tbl keywords
==========
id,keyword
==========
1,key_word
2,key_word

Am I right?

in my example I showed, what is m:n relationship.

Ok, I'm ending with this discussion, coz it doesn't solve your problem, and only turns into flamewar.

Quantum grid is not free nor cheap, but I don't know free replacement with fetures like this component have.

BTW:
If I had to solve that problem, maybe I have to define
keywords varchar(x) into articles and this looks like this
keyword1;keyword2;keyword3
In my point of view, your system is complicated, and hasn't advantages over mine.
0
 
LVL 2

Author Comment

by:123456
ID: 8010502
hi,At first
Some text that you describe in your example about M:N,
1=table article:  article_id,name,text,...

2=table keyword:  keyword_id,keyword

3=table article_keyword:  article_id (foreign key to articles)  keyword_id (foreign key to keywords)

that means for every article exists 0..n keywords( I agree this for my database)
and every keyword is in 0..n articles( I agree this for my database)
fine, every keyword in table_keyword basically is a id(pay attention to mean of keyword),  yes or no ?
if yes I suppose  that this table(table_keyword)  in not necessary, is this true or false?
Finally, I defined a table that mix of two tables one table_article and other table_keyword(that not necessary)
And the result is article_keyword. That give a foreign key from article and table_keyword(that not necessary),
And I bring it(article_keyword) as keywords  table in my database.
We say the same thing but I don’t accept the keyword_table(2) as individual table.

Best Regards
Hamid reza
0
 

Expert Comment

by:modulo
ID: 8225255
Dear expert(s),

A request has been made to close this Q in CS:
http://www.experts-exchange.com/Community_Support/CleanUp/Q_20564704.html

Without a response in 72 hrs, a moderator will finalize this question by:

 - Saving this Q as a PAQ and refunding the points to the questionner

When you agree or disagree, please add a comment here.

Thank you.

modulo

Community Support Moderator
Experts Exchange
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 8239564
Saving this Q as a PAQ and refunding the 50 points to the questionner

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question