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 6 2038
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" <aa*@aaj.com> wrote in message
news:1127380428.ad64af228aac433c8bcff462c6ab33c1@t eranews... 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
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:uM****************@TK2MSFTNGP12.phx.gbl... 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" <aa*@aaj.com> wrote in message news:1127380428.ad64af228aac433c8bcff462c6ab33c1@t eranews... 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
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" <aa*@aaj.com> wrote in message
news:1127384612.4c68022d5514b58b3ed4c21cf89ba788@t eranews... 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:uM****************@TK2MSFTNGP12.phx.gbl... 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" <aa*@aaj.com> wrote in message news:1127380428.ad64af228aac433c8bcff462c6ab33c1@t eranews... 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
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:%2****************@TK2MSFTNGP14.phx.gbl... 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" <aa*@aaj.com> wrote in message news:1127384612.4c68022d5514b58b3ed4c21cf89ba788@t eranews... 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:uM****************@TK2MSFTNGP12.phx.gbl... > 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" <aa*@aaj.com> wrote in message > news:1127380428.ad64af228aac433c8bcff462c6ab33c1@t eranews... >> 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 >> >> > >
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" <aa*@aaj.com> wrote in message
news:1127389297.0b360b7b91185e76ac3818fae918055d@t eranews... 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:%2****************@TK2MSFTNGP14.phx.gbl... 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" <aa*@aaj.com> wrote in message news:1127384612.4c68022d5514b58b3ed4c21cf89ba788@t eranews... 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:uM****************@TK2MSFTNGP12.phx.gbl... > 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" <aa*@aaj.com> wrote in message > news:1127380428.ad64af228aac433c8bcff462c6ab33c1@t eranews... >> 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 >> >> > >
Aaj.
The answer on your question is in my opinion completly written here http://support.microsoft.com/default...b;en-us;317951
I hope this helps,
Cor
"aaj" <aa*@aaj.com> schreef in bericht
news:1127380428.ad64af228aac433c8bcff462c6ab33c1@t eranews... 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sam74 |
last post by:
Hi, I'm writing a program with Microsoft Visual C# .net version 2002
the program has 4 Forms
and all the database components (DataSet, OleDbDataAdapter, OleDbConnection)
are in form4
as I've got...
|
by: Alpha |
last post by:
I have a small Window application and through out the different forms I
create a different dataset. At the begining I used the Tools to drag and
drop the SqlDataAdapter, connection and dataset...
|
by: GaryDean |
last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much
in answers so I'm reposting some questions posted by some of the programmers
here in our organization that never got...
|
by: Mike Wilson |
last post by:
Dear Group,
I have a heirarchical set of database tables, say - "order" and "order_type"
and want to display a series of orders in a grid control, and in place of
the order_type foreign key...
|
by: Luqman |
last post by:
Is it recommended to use datasets in ASP.Net 2.0 / VS.Net 2005 ?
Best Regards,
Luqman
|
by: Ronald S. Cook |
last post by:
I've always used untyped datasets. In a Microsoft course, it walks through
creating typed datasets and harps on the benefits. It has you drag all
these things around ..wizard, wizard, wizard......
|
by: S.Tedeschi |
last post by:
Hi all;
as posted some days ago, I'm converting an on-line app; I used to
heavily rely on strongly-typed DataSets directly dropped onto pages,
and so viewed by code(-behind) as well. In the next...
|
by: BillE |
last post by:
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.
When I use a business object to populate a...
|
by: gardnern |
last post by:
We have X number of data sets, of Y length each.
For example...
Small, Medium, Large
and
Red, Green, Blue, Yellow
We need to generate a list of all possibilities
Small Red
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |