Board index » Visual Studio » Fill 3 data sets at one time or copy one dataset to another

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

Visual Studio350
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.


-
 

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

This is a multi-part message in MIME format.



------=_NextPart_000_0168_01C5298A.C35B1880

Content-Type: text/plain;

charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



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



------=_NextPart_000_0168_01C5298A.C35B1880

Content-Type: text/html;

charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

<META http-equiv=3DContent-Type content=3D"text/html; =

charset=3Diso-8859-1">

<META content=3D"MSHTML 6.00.2900.2604" name=3DGENERATOR>

<STYLE></STYLE>

</HEAD>

<BODY>

<DIV><FONT face=3DArial size=3D2>Chreo,</FONT></DIV>

<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>

<DIV><FONT face=3DArial size=3D2>I hope the wether is good in Kiew, =

:-)</FONT></DIV>

<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>

<DIV><FONT face=3DArial size=3D2>What you do can be a very fine method. =

However use=20

dataviews.</FONT></DIV>

<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>

<DIV><FONT face=3DArial size=3D2>You can than set when the combobox1 =

changes the=20

datarowfilter for the dataview from combobox1</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>and that as well for combobox2 with =

dataview from=20

combobox1</FONT></DIV>

<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>

<DIV><FONT face=3DArial size=3D2>Jak chcesz wi&#281;cej informacji, =

napisz, ale po=20

angielsku.</FONT></DIV>

<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>

<DIV><FONT face=3DArial size=3D2>Cor</FONT></DIV>

<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>



------=_NextPart_000_0168_01C5298A.C35B1880--



-

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

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







-

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

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" :)





-

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

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





-

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

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)





-

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

Anyone can help me with speeding my form?





-