|
|
|
start date: Wed, 11 Jul 2007 13:17:27 +0100,
posted on: microsoft.public.dotnet.framework.adonet
back
| Thread Index |
|
1
DesCF
|
|
2
William \(Bill\) Vaughn
|
|
3
DesCF
|
|
4
William \(Bill\) Vaughn
|
|
5
DesCF
|
|
6
William \(Bill\) Vaughn
|
Access to tables in dataset
Is it possible to treat the tables in the dataset the same as any other
tables, i.e. run queries on them, etc. ?
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Date:Wed, 11 Jul 2007 13:17:27 +0100
Author:
|
Re: Access to tables in dataset
Sure.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"DesCF" wrote in message news:op.tvau3dh2upgxg0@descstar...
> Is it possible to treat the tables in the dataset the same as any other
> tables, i.e. run queries on them, etc. ?
>
>
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Date:Wed, 11 Jul 2007 08:54:52 -0700
Author:
|
Re: Access to tables in dataset
How do you do it then ?
On Wed, 11 Jul 2007 16:54:52 +0100, William (Bill) Vaughn
wrote:
> Sure.
>
"DesCF" wrote in message news:op.tvau3dh2upgxg0@descstar...
> Is it possible to treat the tables in the dataset the same as any other
> tables, i.e. run queries on them, etc. ?
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Date:Wed, 11 Jul 2007 19:03:33 +0100
Author:
|
Re: Access to tables in dataset
I assumed you meant that you wanted to treat the "tables" in the DataSet
(which are DataTable objects) like independent DataTables. You can.
AFA DataTable objects (which should have been called Rowset objects) cannot
be "selected" against as ADO.NET does not YET have a query engine. That's
coming in Orcas. So, no, you can't do JOINs against the tables but you can
sort, find, filter and massage the DataTable objects in a DataSet.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"DesCF" wrote in message news:op.tvba37b9upgxg0@descstar...
> How do you do it then ?
>
>
> On Wed, 11 Jul 2007 16:54:52 +0100, William (Bill) Vaughn
> wrote:
>
>> Sure.
>>
>
> "DesCF" wrote in message
> news:op.tvau3dh2upgxg0@descstar...
>> Is it possible to treat the tables in the dataset the same as any other
>> tables, i.e. run queries on them, etc. ?
>
>
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Date:Wed, 11 Jul 2007 11:30:49 -0700
Author:
|
Re: Access to tables in dataset
The absence of a query engine is what's making things a bit more difficult than they need be then? For example I wanted to validate the existence of a Customer ID entered in a form textbox. At first I was going to run a query against the source tables, but then I remembered that I already had a valid list of Customer ID's in the DataSet (used to populate an adjacent combo box). The difficulty was how to query them for the existence of the Customer ID. Eventually (after quite some fiddling around) I have settled on:
CType(Me.NorthwindDataSet.bdl_CustomersByName.Compute("Count(CustomerID)"CustomerID = '" & txt.Text.Trim.ToUpper & "'"), Boolean)
Mainly because I get a count of 1 or 0 back which lends itself to a boolean Yes/No answer. But is this the best way of doing it? I'd rather do a simple Select statement against the DataTable.
Des
On Wed, 11 Jul 2007 19:30:49 퍝, William (Bill) Vaughn wrote:
> I assumed you meant that you wanted to treat the "tables" in the DataSet
> (which are DataTable objects) like independent DataTables. You can.
>
> AFA DataTable objects (which should have been called Rowset objects) > cannot
> be "selected" against as ADO.NET does not YET have a query engine. That's
> coming in Orcas. So, no, you can't do JOINs against the tables but you> can
> sort, find, filter and massage the DataTable objects in a DataSet.
>
-- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Date:Thu, 12 Jul 2007 14:35:47 +0100
Author:
|
Re: Access to tables in dataset
I might approach this a bit differently. How about binding the list of valid
customer IDs (in the DataTable) to a dropdown list in the UI. That way the
user does not enter a number at all but pick from a list of known good
values.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"DesCF" wrote in message news:op.tvctd2emupgxg0@descstar...
The absence of a query engine is what's making things a bit more difficult
than they need be then? For example I wanted to validate the existence of
a Customer ID entered in a form textbox. At first I was going to run a
query against the source tables, but then I remembered that I already had
a valid list of Customer ID's in the DataSet (used to populate an adjacent
combo box). The difficulty was how to query them for the existence of the
Customer ID. Eventually (after quite some fiddling around) I have settled
on:
CType(Me.NorthwindDataSet.bdl_CustomersByName.Compute("Count(CustomerID)",
"CustomerID = '" & txt.Text.Trim.ToUpper & "'"), Boolean)
Mainly because I get a count of 1 or 0 back which lends itself to a
boolean Yes/No answer. But is this the best way of doing it? I'd rather
do a simple Select statement against the DataTable.
Des
On Wed, 11 Jul 2007 19:30:49 +0100, William (Bill) Vaughn
wrote:
> I assumed you meant that you wanted to treat the "tables" in the DataSet
> (which are DataTable objects) like independent DataTables. You can.
>
> AFA DataTable objects (which should have been called Rowset objects)
> cannot
> be "selected" against as ADO.NET does not YET have a query engine. That's
> coming in Orcas. So, no, you can't do JOINs against the tables but you
> can
> sort, find, filter and massage the DataTable objects in a DataSet.
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Date:Thu, 12 Jul 2007 09:53:20 -0700
Author:
|
|
|