ObjectDataSource Update method and StronglyTyped data tables

M

Max2006

Hi,

I am truing to find a pattern for my Business Logic Layer to be able to work
fine win ObjectDataSource's Update method.


The challenge is ObjectDataSource is not able to work with an update method
that accepts a strongly typed data table as parameters. We have to have an
update method with all data table's columns as its parameter. Like what we
have here: http://asp.net/learn/data-access/tutorial-16-cs.aspx

I am trying to avoid listing all columns as Update method's parameters. Is
there any way to use the actual strongly type data table as the parameter
for ObjectDataSource's update method?

Any help would be appreciated,
Max
 
S

Steven Cheng[MSFT]

Hi Max,

Regarding on the ASP.NET ObjectDataSource and the update method, it will
always require the following parameters pattern:

** a parameter list which represent all the necessary fields of a data
record(or a custom object)

** a custom class instance(whose properties can be mapping to database
record fields)

This reason why ObjectDataSource limit this is that DataSource control is
designed to work together with those complex databound controls, and for
those controls(such as GridView, DataGrid, DataList), its updating model is
one-record(row) per updating time(not batch updating). If you use DataTable
as parameter, that means you want to do batch update which doesn't match
those template databound control's update model. For such scenario, I
think it would be more flexible that you write the udpating code logic your
self so as to batch update multiple records.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top