Last post Jan 09, 2011 03:02 AM by HusamKhoulah
Jan 06, 2011 07:07 AM|Manellen3|LINK
I have problem to check "if the file is success deleted".
This is the algorithm,
if sqldatasource deleted success then
---show message or other action---
Jan 06, 2011 08:15 AM|HusamKhoulah|LINK
maybe you can check the affected rows if use you ExcuteScalar method of the SqlCommand Object
object x = cmd.ExcuteScalar();
if ((int)x > 0)
//that means that some records did get deleted so you can do somthing.
If this Helps Please Mark as Amswer
Jan 06, 2011 09:02 AM|Kulrom|LINK
I would rather use TRANSACTION. The following code should give you an idea i believe
CREATE PROCEDURE PerformTransaction
DECLARE @Success bit;
DELETE FROM MyTable WHERE Field1=@OptionalParam
SET @Success = 1
SET @Success = 0
Now just check the @Success as Return parameter to see if it's 1 or 0. Voila
P.S. Rollback is optional !!!!
Jan 06, 2011 11:19 AM|Manellen3|LINK
Hi HusamKhoulah and
I'm using asp:SqlDataSource control to select, insert, update and also delete data from data base and I'm using asp:GridView control to presented the data after select using that asp:SqlDataSource control.
Now, I have problem to check data while or after asp:SqlDataSouce control delete the data.
I know the event if the asp:SqlDataSource control finish deleted data, that is
SqlDataSource Deleted Event.
And also, while asp:SqlDataSource control delete data, that is SqlDataSource Deleting event.
Here my problem is, what I must do to check the data after delete process from Deleted Event of SqlDataSource?
All of the SQL Query is built up from asp:SqlDataSOurce control, so I'm not write the SQL Query anymore
I hope both of you can help me.
Thanks for your response.
Jan 06, 2011 09:17 PM|silvioyf|LINK
SqlDataSourceStatusEventArgs.AffectedRows property in SqDataSource.Deleted event handler (example).
I hope it is useful.
Jan 09, 2011 03:02 AM|HusamKhoulah|LINK
yes buddy that's right
like the man told above
protected void SqlDataSource1_Deleted(object sender, SqlDataSourceStatusEventArgs e)
//get the number of affected rows
int deletedRows = e.AffectedRows;
If this Helps Please Mark as an Answer