SQLDataSource and Update

  • Thread starter Thread starter Paul
  • Start date Start date
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
 
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.

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

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

********************************************
| Think Outside the Box! |
********************************************
 
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".

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

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

********************************************
| Think Outside the Box! |
********************************************
 
Back
Top