Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
'Refreshing' SQLDataSource with new data
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01346714
Message ID:
01346846
Vues:
10
>>>>Now we put code in RowDeleting (my colleague's attempts) and the RowDeleted event is never fired as well as this code doesn't seem to do the job. Can you help a bit here?
>>>
>>>I don't think RowDeleted fires when you're manually using your own dataset instead of the SqlDataSource.
>>>
>>
>>
>>>Calling Delete on the row just flags it for deletion.
>>
>>So, the row is supposed to be deleted automatically, correct?
>>
>>You have to call AcceptChanges() on the DataTable.
>>
>>Can you please elaborate on that? Our delete should not be a delete, it should set Deleted flag on the table.
>>
>
>Your code is pulling the DataSet out of the Session. When you called Delete() on the row, that sets a flag on the row that it's to be deleted. If that's all you're doing you won't see the row get removed. You have to call AcceptChanges() before it's removed from the datatable (not from the database). There isn't any update happening to update the backend. Something like a DataAdapter would be necessary for persistence to the database; in your code, you're handling deleting it out of the database so that's not even necessary.
>

I see. You're saying that the only missing part in this code is AcceptChanges(). Let me quickly try it. We would also have to call RowDeleted method ourselves from RowDeleting now, I understand.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform