Re: Selecting from Datasets



One last thing about Connection...
SQL provider manage Connection pooling which mean whatever sqlConnection
instance you call it's just one virtual connection with the database managed
by the pooling..
But little thing two know.. if there is any diffrent of any type in the
ConnectionString (Even a space char) this mean another connection so u don't
have to worry about connection..

look at google for .net connection pooling
thanx

Islamegy

"aaj" <aaj@xxxxxxx> wrote in message
news:1127389297.0b360b7b91185e76ac3818fae918055d@xxxxxxxxxxx
> Thanks again for the response
>
> The locating and displaying of filtered rows isn't a problem, as you say I
> can use Table.select etc...
>
> Its the hiding of columns loaded into a dataset that I'm thinking about.
> Almost all the from end relies on reads, and I want to minimise hits to
the
> database file (.sdf) by recreating all necessary information as a dataset
in
> local memory. I want to be able to pull back a table that hold enough
> information for all the classes that will depend on that data to work
> without reqerying the database again i.e. PK, field 1, field 2,field 3
etc
> is held in a table within a dataset.
>
> If I then have a datagrid and I only want it to display Field 1 and field
2,
> I dont want it to requery the database, as it already exists within the
> dataset. But by binding the datagrid to the base dataset/table I then have
> the overhead of removing each of the unused field. It just seems to me
much
> more sensible to build a second datatable with just the columns needed at
> that instant and bind the grid to this instead, that way only the columns
I
> want to see are there, and there has been no hits to the database..
>
> These copies for display will be transient and so only one copy of the
extra
> data will be needed at any time, the object will be destroyed as soon as
it
> is no longer displayed on the page, so there shouldn't be a memory
problem.
>
> From the discussions so far, It looks as though I cannot do this using the
> built in functionality available. Thinking about it I suppose I could
write
> a class to do this for me, manually poplate the relevant columns from a
> source into a new datatable, and provide an accessor to this class for the
> GUI.
>
> One reason I'm trying to do it this way is to ensure that there is only
one
> connection to the database as as far as I know, sdf files only support a
> single open connection. If I let GUI classes contact the database each
time
> they need data, I'm imaginining that the overheads would be greater than
> hitting an internal dataset.
>
> again thanks for the help/advice so far, its an interesting discussion and
> I'm always keen to see how other do things 8-)
>
> thanks again
>
> Andy
>
> "Islamegy" <islamegy#@#yahoo#.#com> wrote in message
> news:%23cgHAU2vFHA.3236@xxxxxxxxxxxxxxxxxxxxxxx
> > Using your way will consume memory.. you want a new copy from you data
> > which
> > is already there in memory in new dataset..
> > and i can see you want to use this technique everywhere u need few
columns
> > which mean you will have so many copy of data!! i see it nonsense..
> >
> > running query on a dataset is in memory operation and
> > using tablestyle in a grid will filter data for you (exactly the same)
> > without duplicate data in memory..
> >
> > Use Dataview Filter or you may use Datatable Select() or
> > datatable1.Rows.Find(some PKey) to get single row... and u won't need to
> > query the database again.
> >
> > hope this could help..
> > Islamegy
> >
> > "aaj" <aaj@xxxxxxx> wrote in message
> > news:1127384612.4c68022d5514b58b3ed4c21cf89ba788@xxxxxxxxxxx
> >> Hi Islamegy
> >>
> >> Thanks for the reply
> >>
> >> You are correct in your understanding of what I'm trying to achieve
i.e.
> >> execute a select on the first dataset to populate a second dataset, and
I
> >> think also you are correct that it doesn't look as though I can.
> >>
> >> Just to explain a little further, the reason I bring back all the
columns
> > is
> >> that I need the extra data elsewhere in the program e.g. I may have a
> > table
> >> for people who have firstname, lastname, address, telephone etc, but I
> >> may
> >> only want to display firstname and last name in a particular datagrid,
> >> but
> >> else where I need to know the primary key (when I do an update), and in
> >> different section I might want to show the address and telephone number
> > etc,
> >> but I don't want to re query the source database each time.
> >>
> >> I know that I could query the source database directly each time I need
> > data
> >> certain views of data for their datagrid, and modify the dataadapters
> > select
> >> to pull back the relevant columns, but I'm working on Pocket PC with
> >> SQLServer CE at the be, and I would like to keep access to a minumum,
by
> >> having all read data buffered in a dataset for reads, and controlling
> > writes
> >> as necessary.
> >>
> >> I think your correct in using the TableStyle, that's what I'm using at
> >> the
> >> moment, and then removing the columns I don't need. It's this way of
> >> doing
> >> things that prompted me to ask the question, as I don't think its
> >> sensible
> >> to read in say 24 columns into the datagrid and then to delete 22 of
them
> > to
> >> be left with the necessary ones
> >>
> >> I think it would be more sensible to read all the necessary tables into
a
> >> dataset so in effect this becomes a virtual database, and then be able
to
> >> SELECT the columns I need into some sort of view, so only the relevant
> > data
> >> is displayed.
> >>
> >> thanks again
> >>
> >> Andy
> >>
> >>
> >> "Islamegy" <islamegy#@#yahoo#.#com> wrote in message
> >> news:uMt%23eq1vFHA.2292@xxxxxxxxxxxxxxxxxxxxxxx
> >> > Do u mean you want to excute select query on first dataset?? I think
> >> > you
> >> > can't..
> >> > I don't know why you get the all columns if you only need two.
> >> > For "Select........" you could Use add TableStyle to the datagrid and
> >> > display 2 columns only.
> >> > For "Where....." bind your gread to Dataview instead of dataset & use
> >> > RowFilter="colname like"+somecondition.
> >> >
> >> > Islamegy
> >> >
> >> >
> >> > "aaj" <aaj@xxxxxxx> wrote in message
> >> > news:1127380428.ad64af228aac433c8bcff462c6ab33c1@xxxxxxxxxxx
> >> >> Hi all
> >> >>
> >> >> I use a data adapter to read numerous tables in to a dataset.
> >> >>
> >> >> The dataset holds tables which in turn holds full details of the
> > records
> >> >> i.e. keys, extra colums etc..
> >> >>
> >> >> In some cases I need to use parts of the tables in datagrids, and
here
> > is
> >> >> where my problem lies
> >> >>
> >> >> lets say the Table in the dataset has 25 columns, but for display
> >> >> purposes
> >> >> Im only interested in 2 of the columns, I envisage building a second
> >> >> (sub)
> >> >> dataset and selecting the columns I'm interested in i.e. "SELECT
> >> >> firstname,lastname from ..... WHERE ...." and using this as the sub
> >> > DataSet,
> >> >> ready for the datagrid, but I can't for the life of me figure how to
> >> >> do
> >> > this
> >> >>
> >> >> any advice would be most welcome
> >> >>
> >> >> thanks
> >> >>
> >> >> Andy
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>


.



Relevant Pages

  • Re: ADO Connection Timeout
    ... so what happens when a connection failure forces one station to revert ... to a local database? ... Further, you *will* have contention issues, Jet does not support record ... to the central server, but you are willing to live with periods where it ...
    (microsoft.public.data.ado)
  • Re: Huge data
    ... >> connect everytime to the database to get a record or a group of records ... >> take more time than retreiving all the data and work with it offline, ... > underlying database connection each time - connection pooling takes ... > memory at a time, unless you're updating every row in the table. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Selecting from Datasets
    ... If I then have a datagrid and I only want it to display Field 1 and field 2, ... I dont want it to requery the database, as it already exists within the ... is no longer displayed on the page, so there shouldn't be a memory problem. ... > query the database again. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Oracle connections and memory usage
    ... > each connection to the database is sucking up 7MB of memory which ... > Is there anything that I can tune to improve memory usage or is there ... SG24-5511-00 Database Performance on AIX in DB2 UDB and Oracle Environments ... No. *I* am your father. ...
    (AIX-L)
  • Re: ADO Connection Timeout
    ... When the first test is run, the results are stored in the central database. ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
    (microsoft.public.data.ado)