PC Review


Reply
Thread Tools Rate Thread

Access to tables in dataset

 
 
DesCF
Guest
Posts: n/a
 
      11th Jul 2007
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/
 
Reply With Quote
 
 
 
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      11th Jul 2007
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" <(E-Mail Removed)> wrote in message newsp.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/



 
Reply With Quote
 
DesCF
Guest
Posts: n/a
 
      11th Jul 2007
How do you do it then ?


On Wed, 11 Jul 2007 16:54:52 +0100, William (Bill) Vaughn
<(E-Mail Removed)> wrote:

> Sure.
>


"DesCF" <(E-Mail Removed)> wrote in message newsp.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/
 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      11th Jul 2007
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" <(E-Mail Removed)> wrote in message newsp.tvba37b9upgxg0@descstar...
> How do you do it then ?
>
>
> On Wed, 11 Jul 2007 16:54:52 +0100, William (Bill) Vaughn
> <(E-Mail Removed)> wrote:
>
>> Sure.
>>

>
> "DesCF" <(E-Mail Removed)> wrote in message
> newsp.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/



 
Reply With Quote
 
DesCF
Guest
Posts: n/a
 
      12th Jul 2007

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
<(E-Mail Removed)> 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/
 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      12th Jul 2007
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" <(E-Mail Removed)> wrote in message newsp.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
<(E-Mail Removed)> 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/


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to loop through all tables in an Access dataset =?Utf-8?B?Y2h1bg==?= Microsoft Access VBA Modules 6 20th Nov 2007 09:27 PM
DataSet Designer/adding multiple tables to a dataset/ how? =?Utf-8?B?Q3VydGlz?= Microsoft ADO .NET 1 21st Aug 2006 02:09 PM
How to update dataset.Tables["tab1"] from records in dataset.Tables["tab2"]? AndiSHFR Microsoft C# .NET 1 12th Jan 2006 06:41 AM
Data Access Application Block v3.0: How to fill DataSet with multi tables feng Microsoft ADO .NET 1 5th Oct 2004 04:08 PM
DataSet Tables into Access tables with Oledb? Nevyn Twyll Microsoft ADO .NET 6 2nd Sep 2004 08:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:38 PM.