Database Structure and XML

  • Thread starter Thread starter Jerome Schnitzler
  • Start date Start date
J

Jerome Schnitzler

Hello NG,

I have the following problem. I recieve a dBase file and want to access it
via ASP.NET and ADO.NET. So far so good (thanx to Jan again).

The problem is now, that there are three important columns, which are
responsible for sorting. I call them GROUP1, 2 and 3. If I select GROUP1 I
recieve some rows in GROUP2 .... and so on. My problem is, that I need some
DropDownList elements, one for each group. The Database ich changing these
groups from time to time and I need to generate them automatically. My first
idea was to write them into a XML-file, but the database has 30,000 entries
and that would be too much work. I hope you know, what I try to do and have
an idea for me.


Bye

Jerome
 
Jerome,

Do you mean the first DropDownList needs to show all the distinct elements
of the Group1 column, the second DropDownList all the distinct elements from
the Group 2 column and the third Dr.. from Gr 3 column ?

What do you mean by "The Database is changing these groups from time to time
and I need to generate them automatically" ? Do you mean that the content
of the DropDownLists has to be adapted automatically ?

Regards,
Jan
 
Jan said:
Jerome,

Do you mean the first DropDownList needs to show all the distinct elements
of the Group1 column, the second DropDownList all the distinct elements from
the Group 2 column and the third Dr.. from Gr 3 column ?

Yeah ... when Group1 is selected Group2 is generated, but Group2 depends on
the selection in Group1.
What do you mean by "The Database is changing these groups from time to time
and I need to generate them automatically" ? Do you mean that the content
of the DropDownLists has to be adapted automatically ?

Exactly. But I'm afraid of the performance. This will be a problem of
performance and usability. The database is changing every day. So it should
be also usable for me.
 
Jerome,

I'm not really familiar with the Webform controls, but in a Winform
environment I would proceed as follows :
1. Create a datatable (dt1) filled with the distinct elements for the group1
column and bind dt1 to the first DropDownListBox (cbo1).
2. When the user selects a value in cbo1, in the SelectedIndexChanged event
of cbo1 create another datatable (dt2) with all distinct elements for the
group2 column for which the group1-value is equal to the value selected in
cbo1. Bind dt2 to cbo2.
3. When the user selects a value in cbo2, in the SelectedIndexChanged event
of cbo2 create another datatable (dt3) with all distinct elements for the
group3 column for which the group1-value is equal to the value selected in
cbo1 and for which the group2-value is equal to the value selected in cbo2.
Bind dt3 to cbo3.
4. When the users selects a value in cbo3 .....

In this way the DropDownListBoxes are filled on the fly and use whatever
data is available when the user loads the page.

Regards,
Jan
 
Jan said:
Jerome,

I'm not really familiar with the Webform controls, but in a Winform
environment I would proceed as follows :
1. Create a datatable (dt1) filled with the distinct elements for the group1
column and bind dt1 to the first DropDownListBox (cbo1).
2. When the user selects a value in cbo1, in the SelectedIndexChanged event
of cbo1 create another datatable (dt2) with all distinct elements for the
group2 column for which the group1-value is equal to the value selected in
cbo1. Bind dt2 to cbo2.
3. When the user selects a value in cbo2, in the SelectedIndexChanged event
of cbo2 create another datatable (dt3) with all distinct elements for the
group3 column for which the group1-value is equal to the value selected in
cbo1 and for which the group2-value is equal to the value selected in cbo2.
Bind dt3 to cbo3.
4. When the users selects a value in cbo3 .....

In this way the DropDownListBoxes are filled on the fly and use whatever
data is available when the user loads the page.

Regards,
Jan

I also had this idea but the database looks like

GROUP1 GROUP2 GROUP3
a c e
a c f
a c g
a d g
a d e
b c e

and a is always the full name ... no placeholder. The database consists of
only one table.

Your way I would recieve a DropDownList like this:

a
a
a
a
a
b
.........

You see the problem? :-)
 
Jerome,

That's why I mentionned 'DISTINCT' in my previous post.
To fill datatable dt1 use following SQL-query :
SELECT DISTINCT group1 FROM mydatabase

This will give you for Group1 only a single a and a single b.

Group2 and 3 are similar.

Regards,
Jan
 
Jan said:
Jerome,

That's why I mentionned 'DISTINCT' in my previous post.
To fill datatable dt1 use following SQL-query :
SELECT DISTINCT group1 FROM mydatabase

This will give you for Group1 only a single a and a single b.

WOW ... you are great ... that's the solution ... mega thanx ;-)
 
Back
Top