SQLDataSource and Update

P

Paul

I have a SQLDataSource.

It has a SelectCommand with a query that has a several JOINs.

I have a UpdateCommand that does not work.

Is it true that if the SelectCommand has any joins, then the UpdateCommand
does not work "automatically"?

If that is true, then how can I use the UpdateCommand if my SelectCommand
has joins in it?

TIA
 
G

Gregory A. Beamer

If you are using .NET 2.0 DataSets, you can add a SQL Query for update and
use it. This means you will be coding against the TableAdapter to update.

Another option is to set up a stored procedure and connect it to the
UpdateCommand. You will have to match the fields, but this can be done
declaratively in the tagged ASPX page.

A third option is to write your own update query in the tagged ASPX page. If
you need help, try a simple SqlDataSource (one table) and look at how the
CRUD is handled. You cna then mimic this operation with your own SQL query
and field mappings.

I am sure there are other options here.
 
G

Gregory A. Beamer

You can, however, get complex enough that it cannot create the query plan
for the update. This may be where the OP is. Thanks for the article, it is a
nice one to add to my "help file".
 

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,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top