PC Review


Reply
Thread Tools Rate Thread

Adding additional SELECTs to dataadapter

 
 
John
Guest
Posts: n/a
 
      8th Jan 2009
Hi

I need to add additional SELECT commands to dataadapter that take various
filter and order by parameters. How do I add these additional commands to
the dataadapter?

Thanks

Regards


 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      8th Jan 2009
John,

At least I can not imagen any thing you mean by your problem.

Can you show us the Transactcode

Cor

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I need to add additional SELECT commands to dataadapter that take various
> filter and order by parameters. How do I add these additional commands to
> the dataadapter?
>
> Thanks
>
> Regards
>
>


 
Reply With Quote
 
William Vaughn \(MVP\)
Guest
Posts: n/a
 
      8th Jan 2009
The (obsolete) DataAdapter can only accept on SelectCommand. While that
Command can contain several SELECT statements and these can have multiple
Parameters, it returns one resultset and generates one DataTable for each
rowset returned.

I expect what you need is a TableAdapter. This class can have several Fill
methods that can be programmed to return a rowset/DataTable given different
SELECT statements (as long as the same columns are returned) and different
Parameters.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com http://betav.com/blog/billva
____________________________________________________________________________________________



"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I need to add additional SELECT commands to dataadapter that take various
> filter and order by parameters. How do I add these additional commands to
> the dataadapter?
>
> Thanks
>
> Regards
>
>

 
Reply With Quote
 
John
Guest
Posts: n/a
 
      8th Jan 2009
You are correct TableAdapter. How do I add additional sql to it such as
FillByFieldA, FillByFieldAandFieldB etc.

Thanks

Regards

"William Vaughn (MVP)" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The (obsolete) DataAdapter can only accept on SelectCommand. While that
> Command can contain several SELECT statements and these can have multiple
> Parameters, it returns one resultset and generates one DataTable for each
> rowset returned.
>
> I expect what you need is a TableAdapter. This class can have several Fill
> methods that can be programmed to return a rowset/DataTable given
> different SELECT statements (as long as the same columns are returned) and
> different Parameters.
>
> --
> __________________________________________________________________________
> William R. Vaughn
> President and Founder Beta V Corporation
> Author, Mentor, Dad, Grandpa
> Microsoft MVP
> (425) 556-9205 (Pacific time)
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> http://betav.com http://betav.com/blog/billva
> ____________________________________________________________________________________________
>
>
>
> "John" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi
>>
>> I need to add additional SELECT commands to dataadapter that take various
>> filter and order by parameters. How do I add these additional commands to
>> the dataadapter?
>>
>> Thanks
>>
>> Regards
>>
>>



 
Reply With Quote
 
John
Guest
Posts: n/a
 
      8th Jan 2009
Sorry Cor, I meant TableAdapter.

Thanks

Regards

"Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> John,
>
> At least I can not imagen any thing you mean by your problem.
>
> Can you show us the Transactcode
>
> Cor
>
> "John" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi
>>
>> I need to add additional SELECT commands to dataadapter that take various
>> filter and order by parameters. How do I add these additional commands to
>> the dataadapter?
>>
>> Thanks
>>
>> Regards
>>
>>

>



 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      8th Jan 2009
Open the DataSet in the designer and right click on the table in question.
you can then choose to add a new command. Add each command you desire, one
by one, and you are done.

While this is not a precise answer to your question, there is a step-by-step
for creating new queries in this blog entry:
http://gregorybeamer.spaces.live.com/Blog/cns!B036196EAF9B34A8!974.entry

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You are correct TableAdapter. How do I add additional sql to it such as
> FillByFieldA, FillByFieldAandFieldB etc.
>
> Thanks
>
> Regards
>
> "William Vaughn (MVP)" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> The (obsolete) DataAdapter can only accept on SelectCommand. While that
>> Command can contain several SELECT statements and these can have multiple
>> Parameters, it returns one resultset and generates one DataTable for each
>> rowset returned.
>>
>> I expect what you need is a TableAdapter. This class can have several
>> Fill methods that can be programmed to return a rowset/DataTable given
>> different SELECT statements (as long as the same columns are returned)
>> and different Parameters.
>>
>> --
>> __________________________________________________________________________
>> William R. Vaughn
>> President and Founder Beta V Corporation
>> Author, Mentor, Dad, Grandpa
>> Microsoft MVP
>> (425) 556-9205 (Pacific time)
>> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
>> http://betav.com http://betav.com/blog/billva
>> ____________________________________________________________________________________________
>>
>>
>>
>> "John" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi
>>>
>>> I need to add additional SELECT commands to dataadapter that take
>>> various filter and order by parameters. How do I add these additional
>>> commands to the dataadapter?
>>>
>>> Thanks
>>>
>>> Regards
>>>
>>>

>
>


 
Reply With Quote
 
John
Guest
Posts: n/a
 
      8th Jan 2009
Hi Gregory

I need to do this at runtime as there are two many options to add at design
time.

Thanks

Regards

"Gregory A. Beamer" <(E-Mail Removed)> wrote in message
news:7DAA3EDF-74DF-435D-B085-(E-Mail Removed)...
> Open the DataSet in the designer and right click on the table in question.
> you can then choose to add a new command. Add each command you desire, one
> by one, and you are done.
>
> While this is not a precise answer to your question, there is a
> step-by-step for creating new queries in this blog entry:
> http://gregorybeamer.spaces.live.com/Blog/cns!B036196EAF9B34A8!974.entry
>
> --
> Gregory A. Beamer
> MVP: MCP: +I, SE, SD, DBA
>
> Blog:
> http://feeds.feedburner.com/GregoryBeamer
>
> ********************************************
> | Think Outside the Box! |
> ********************************************
> "John" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> You are correct TableAdapter. How do I add additional sql to it such as
>> FillByFieldA, FillByFieldAandFieldB etc.
>>
>> Thanks
>>
>> Regards
>>
>> "William Vaughn (MVP)" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> The (obsolete) DataAdapter can only accept on SelectCommand. While that
>>> Command can contain several SELECT statements and these can have
>>> multiple Parameters, it returns one resultset and generates one
>>> DataTable for each rowset returned.
>>>
>>> I expect what you need is a TableAdapter. This class can have several
>>> Fill methods that can be programmed to return a rowset/DataTable given
>>> different SELECT statements (as long as the same columns are returned)
>>> and different Parameters.
>>>
>>> --
>>> __________________________________________________________________________
>>> William R. Vaughn
>>> President and Founder Beta V Corporation
>>> Author, Mentor, Dad, Grandpa
>>> Microsoft MVP
>>> (425) 556-9205 (Pacific time)
>>> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
>>> http://betav.com http://betav.com/blog/billva
>>> ____________________________________________________________________________________________
>>>
>>>
>>>
>>> "John" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Hi
>>>>
>>>> I need to add additional SELECT commands to dataadapter that take
>>>> various filter and order by parameters. How do I add these additional
>>>> commands to the dataadapter?
>>>>
>>>> Thanks
>>>>
>>>> Regards
>>>>
>>>>

>>
>>

>



 
Reply With Quote
 
William Vaughn \(MVP\)
Guest
Posts: n/a
 
      9th Jan 2009
Ah, no. The TableAdapter is a strongly typed class that's constructed by
Visual Studio code generators at design time.
I suggest building one or more Command objects at runtime. They can be
configured with any SELECT statement(s) you need and the DataReader created
by the Command ExecuteReader method can be used to build an untyped
DataTable.

I discuss this in my book at length...

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com http://betav.com/blog/billva
____________________________________________________________________________________________



"John" <(E-Mail Removed)> wrote in message
news:O#(E-Mail Removed)...
> Hi Gregory
>
> I need to do this at runtime as there are two many options to add at
> design time.
>
> Thanks
>
> Regards
>
> "Gregory A. Beamer" <(E-Mail Removed)> wrote in message
> news:7DAA3EDF-74DF-435D-B085-(E-Mail Removed)...
>> Open the DataSet in the designer and right click on the table in
>> question. you can then choose to add a new command. Add each command you
>> desire, one by one, and you are done.
>>
>> While this is not a precise answer to your question, there is a
>> step-by-step for creating new queries in this blog entry:
>> http://gregorybeamer.spaces.live.com/Blog/cns!B036196EAF9B34A8!974.entry
>>
>> --
>> Gregory A. Beamer
>> MVP: MCP: +I, SE, SD, DBA
>>
>> Blog:
>> http://feeds.feedburner.com/GregoryBeamer
>>
>> ********************************************
>> | Think Outside the Box! |
>> ********************************************
>> "John" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> You are correct TableAdapter. How do I add additional sql to it such as
>>> FillByFieldA, FillByFieldAandFieldB etc.
>>>
>>> Thanks
>>>
>>> Regards
>>>
>>> "William Vaughn (MVP)" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> The (obsolete) DataAdapter can only accept on SelectCommand. While that
>>>> Command can contain several SELECT statements and these can have
>>>> multiple Parameters, it returns one resultset and generates one
>>>> DataTable for each rowset returned.
>>>>
>>>> I expect what you need is a TableAdapter. This class can have several
>>>> Fill methods that can be programmed to return a rowset/DataTable given
>>>> different SELECT statements (as long as the same columns are returned)
>>>> and different Parameters.
>>>>
>>>> --
>>>> __________________________________________________________________________
>>>> William R. Vaughn
>>>> President and Founder Beta V Corporation
>>>> Author, Mentor, Dad, Grandpa
>>>> Microsoft MVP
>>>> (425) 556-9205 (Pacific time)
>>>> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
>>>> http://betav.com http://betav.com/blog/billva
>>>> ____________________________________________________________________________________________
>>>>
>>>>
>>>>
>>>> "John" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Hi
>>>>>
>>>>> I need to add additional SELECT commands to dataadapter that take
>>>>> various filter and order by parameters. How do I add these additional
>>>>> commands to the dataadapter?
>>>>>
>>>>> Thanks
>>>>>
>>>>> Regards
>>>>>
>>>>>
>>>
>>>

>>

>
>

 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      9th Jan 2009
In addition to Bill, you could create SqlCommand instance as well, a
DbDataAdapter instance (one for your database), attach SqlCommand instance
to DbDataAdapter.SelectCommand and use that DbDataAdapter instance to
retrieve data.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/


"John" <(E-Mail Removed)> wrote in message
news:O%(E-Mail Removed)...
> Hi Gregory
>
> I need to do this at runtime as there are two many options to add at
> design time.


 
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
Adding additional SELECTs to dataadapter John Microsoft VB .NET 9 9th Jan 2009 09:13 AM
Adding a record to an Access db using DataAdapter.Update Winshent Microsoft ADO .NET 1 15th Jul 2005 01:45 AM
Adding a record to an Access db using DataAdapter.Update Winshent Microsoft VB .NET 1 15th Jul 2005 01:45 AM
Adding Parameters to WHERE clause in DataAdapter Mike D Microsoft C# .NET 3 17th Dec 2004 03:03 PM
DataAdapter.Update() adding row with identity field PeterB Microsoft Dot NET Compact Framework 0 26th Aug 2003 05:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:13 AM.