Fill 3 data sets at one time or copy one dataset to another

C

chreo

Sorry for weird title and sorry for my English (I'm from Poland).

This is the problem:
I have form with many controls.
There are three comboboxes - each should have table STREETS as DataSource.

1) If I connect each combobox to one Dataset then if I choose street in one
combobox it changes also in combobox 2 and 3.
So one dataset to three comboboxes is bad idea, isn't it?
But filling one dataset is fast.

2) So I changed it. Now I have 3 datasets and 3 comboboxes - if I change
street in one then it doesn't change anything in rest of boxes.
Great! But when i open form then filling three dataset with the same values
takes too much time.
Because it is copying table STREETS from MSSQL Database to one dataset, then
to second and...to third dataset.

QUESTION:
A) Did I do something wrong? - I'm sure I did because I'm rookie (amateur).
B) Is it possible to copy STREETS from 1 dataset to dataset 2 and 3 - and
does it take much time?
C) Maybe it is possible to fill one dataset only and connect it to three
comboboxes and each combox is independent from other...

I HOPE somebody has understood me and I BEG you for answer.
THANX from Poland.
 
C

Cor Ligthert

Chreo,

I hope the wether is good in Kiew, :)

What you do can be a very fine method. However use dataviews.

You can than set when the combobox1 changes the datarowfilter for the dataview from combobox1
and that as well for combobox2 with dataview from combobox1

Jak chcesz wiecej informacji, napisz, ale po angielsku.

Cor
 
C

Cor Ligthert

You can than set when the combobox1 changes the datarowfilter for the
dataview from combobox1
and that as well for combobox2 with dataview from combobox3
 
C

chreo

I haven't use DATAVIEW yet but thanx I will try that as soon as I teach how
to make dataview :)

By the way - capital of Poland is Warsaw and I hope that was joke with
"Kiev" :)
 
C

Cor Ligthert

Chreo.

I thought the capital from Poland was Chicago, do you think that somebody
who gives you an answer in Polish does not know the capital from Poland.
However I had success with that.

To show you how you can by instance do it.

In top of your program
dim swLoad as boolean

than where you have filled your datasets

dim dv1 as new dataview(ds.tables("firsttable"))
this 3 times from 1 to 3

combobox1.datasource = dv1
the rest the same as it was
however as well 3 times

and then
swLoad = true

in the selectedindexchangeevent from the combobox1 (and combobox2)
\\\
if swLoad = true then
dv2.rowfilter = "myfield = '" & combobox1.selectedvalue.tostring & "'"
end if
///

I hope this helps,

Cor
 
C

chreo

Yeah!
It loads about 40% faster.
It was 15sec earlier and now is 8-10sec... :)

Now I must find out what to do to not load each dataset every time I refresh
the form.

for example:
I am adding new costumers and when I save one costumer then the form opens
again to add another costumer.
What to do to only update rows in dataset which were not in that datasets
earlier.
(for example there was dataset with NAMES and I added new NAME when 1st
costumer was saved,
now I want only update dataset with this one NAME and not all table NAMES
again)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top