Answered by:
sqldatasource dictionary

Question
-
User279080766 posted
I am attempting to delete a record within a database controled by a sqldatasource control using the syntext of "sqldatasource1.delete". I receive an error message that states "You have specified that your delete command compares all values on SqlDataSource 'SqlDataSource1', but the dictionary passed in for values is empty. Pass in a valid dictionary for delete or change your mode to OverwriteChanges.". I have been trying to find how to correct the problem by loading or passing in a valid dictionary, but I cann't find any statement or command to do so. How does one load or pass in a valid dictionary?
Tuesday, July 24, 2007 7:43 PM
Answers
-
User-821857111 posted
At the moment, you have specified that the SqlDataSource should CompareAllChanges, but you don't appear to have a correctly formatted original_id for the Delete command. Have a look at this: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/databases.aspx (about half way down - GridView Updating), or change the CompareAllChanges to OverWriteChanges.
CompareAllChanges will only delete or update if no one has altered the record since your page extracted it from the database. OverWriteChanges uses the last-in-wins approach instead.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, July 25, 2007 3:52 AM
All replies
-
User-821857111 posted
At the moment, you have specified that the SqlDataSource should CompareAllChanges, but you don't appear to have a correctly formatted original_id for the Delete command. Have a look at this: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/databases.aspx (about half way down - GridView Updating), or change the CompareAllChanges to OverWriteChanges.
CompareAllChanges will only delete or update if no one has altered the record since your page extracted it from the database. OverWriteChanges uses the last-in-wins approach instead.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, July 25, 2007 3:52 AM -
User279080766 posted
I understand what you are writting; however, the data has not be changed since it was loaded into the gridview. The data filled the gridview, a row was selected to obtain the GUID, which was used to obtain the members name so roles.delete could be called and now to delete the listing in the clubDB, I called sqldatasource.delete. That is when I get the error. I would expect that the data dictorary would still be loaded iwth the origianal_data but it isn't. Why?
Wednesday, July 25, 2007 7:08 PM -
User279080766 posted
The solution was to dim id as string = gridviedw1.selectedvalue.tostring and use "SqlDataSource1.DeleteParameters("memberid").DefaultValue= id".
Of course, I had to set the delete statement in the SqlDataSource and establish the deleteparameter.
This statement does not seem to be documentated in the help files. I had to obtain it through a "how to access data" help.
Monday, July 30, 2007 12:18 PM