I have a GridView dispalying from a SQLServerDataSource that is using a SQL Select Union statement (like the following):
SELECT
FirstName,
LastName
FROM
Master
UNION ALL
SELECT
FirstName,
LastName
FROM
Custom
ORDER BY
LastName,
FirstName
I am wondering how to create Update and Insert statements for this SQLServerDataSource since the select is actually driving from two different tables (Master and Custom). Any ideas if or how this can be done? Specifically, I want the Custom table to be editable, but not the Master table. Any examples or ideas would be very much appreciated!
Thanks,
Randy
SELECT
FirstName,
LastName,0 AS Editable
FROM
Master
UNION ALL
SELECT
FirstName,
LastName,1 AS Editable
FROM
Custom
ORDER BY
LastName,
FirstName
Only allow rows that editable is 1 to be edited, then use an update statement directly on custom for the rows that get editted.
|||Thank you for the direction. I am unclear on your last sentence...can you provide a code snippet that illustrates what you are explaning?
I appreciate the help
Randy
|||UPDATE Custom SETFirstName=@.FirstName,LastName=@.LastName WHEREFirstname=@.original_FirstName ANDLastName=@.original_LastName
|||
Thanks, the Update statement makes sense.
Last question: when you say "Only allow rows that editable is 1 to be edited", can you provide direction on what the code would be such that the EditTemplate never appears for Editable = 0? (i.e. so that Rows where Editable = 1 can go into edit mode but rows where Editable = 0 cannot).
Sorry for what may be basic questions...
|||I really can't without knowing more about what it is you are trying to do, or how you've implemented your edit functionality.
No comments:
Post a Comment