I am trying to soft delete a row in the table. Once I update it, if I want to undelete my row, I should be able to do it. Also, I like to purge delete, permanent delete. I am using SQL client using C# Windows Forms (NO ENTITY).
The soft delete code below:
conn1.Open(); // conn1 which is my object and sql command open
SqlCommand cmd = conn1.CreateCommand(); // sql command to create new object
cmd.CommandType = CommandType.Text; // setting up text SQL command
cmd.CommandText = "IsDeleted = 0 from [Table] where ADD_UID= '" + textBox1.Text + "'"; //Select which Table and Row Based on Deleting
cmd.ExecuteNonQuery();
conn1.Close();
textBox1.Clear();
I am getting this error:
However I am able to delete a row without any error using delete command instead of saying isdelete
. Is there any other way to soft delete and physical delete in SQL client without using ENTITY.