B
Bogdan
Hi,
I have a stored procedure that uses JOINs to return columns from multiple
tables. I also have another stored proc that that takes a series of params
and updates multiple tables. I used the framework to auto-generate a table
adapter specifying both stored procs as Get/Fill and Update. The problem is
that columns from the JOINed table seem to marked as 'read-only' so trying
to update a row results in an exception. BTW, by default a FormView
attached (indirectly through ODS and BLL) to the table adapter did not show
Edit/Insert/Delete buttons. I had to switch its default mode to Edit.
I remember reading about JOINs and TableAdapters and that they do not work
well together. I'm not sure though is this was also applicable to stored
procedures. It was suggested that subqueries be used instead. The problem
is that subqueries are good if used with one field per JOINed table. In my
case, I need to join 3 tables and each of them has about 5 columns.
So, my questions is:
Can table adapters be used with stored procedures that take columns from
multiple tables for update purposes? If yes, could someone please let me
know how to do that? If not, what are the alternatives?
I would really, really appreciate _any_ suggestions.
My example of select and update procs:
SELECT a.c1, a.c2, a.c3,
b.c1, b.c2, bc3,
c.c1, c.c2, c.c3,
d.c1, d.c2, d.c3
FROM A a
INNER JOIN B b ON a.c1= b.c1
LEFT OUTER JOIN C c ON a.c1 = c.c1
LEFT OUTER JOIN D d ON a.c1 = d.c1
WHERE a.c1 = @c1;
[...]
-- Update
@ac2 int,
@ac3 int,
@bc2 int,
@bc3 int,
@cc2 int,
[...]
UPDATE A
SET c2 = @ac2 [...]
UPDATE B
SET c2 = @bc2 [...]
etc.
Thanks,
Bogdan
I have a stored procedure that uses JOINs to return columns from multiple
tables. I also have another stored proc that that takes a series of params
and updates multiple tables. I used the framework to auto-generate a table
adapter specifying both stored procs as Get/Fill and Update. The problem is
that columns from the JOINed table seem to marked as 'read-only' so trying
to update a row results in an exception. BTW, by default a FormView
attached (indirectly through ODS and BLL) to the table adapter did not show
Edit/Insert/Delete buttons. I had to switch its default mode to Edit.
I remember reading about JOINs and TableAdapters and that they do not work
well together. I'm not sure though is this was also applicable to stored
procedures. It was suggested that subqueries be used instead. The problem
is that subqueries are good if used with one field per JOINed table. In my
case, I need to join 3 tables and each of them has about 5 columns.
So, my questions is:
Can table adapters be used with stored procedures that take columns from
multiple tables for update purposes? If yes, could someone please let me
know how to do that? If not, what are the alternatives?
I would really, really appreciate _any_ suggestions.
My example of select and update procs:
SELECT a.c1, a.c2, a.c3,
b.c1, b.c2, bc3,
c.c1, c.c2, c.c3,
d.c1, d.c2, d.c3
FROM A a
INNER JOIN B b ON a.c1= b.c1
LEFT OUTER JOIN C c ON a.c1 = c.c1
LEFT OUTER JOIN D d ON a.c1 = d.c1
WHERE a.c1 = @c1;
[...]
-- Update
@ac2 int,
@ac3 int,
@bc2 int,
@bc3 int,
@cc2 int,
[...]
UPDATE A
SET c2 = @ac2 [...]
UPDATE B
SET c2 = @bc2 [...]
etc.
Thanks,
Bogdan