Hi I am not able to delete a single row in MVC, where if i try to delete one row the entire rows were getting deleted. Here is my delete method
public string DeleteRegistrationForm(int ID) { string Msg = null; Database database = DatabaseFactory.CreateDatabase(); DataSet ds = new DataSet(); // List<Registrationform> results = new List<Registrationform>(); try { string str = "DeleteStudentDetails"; DbCommand storedProcCommand = database.GetStoredProcCommand(str); ds = database.ExecuteDataSet(storedProcCommand); ds.GetChanges(); Msg = "DeleteOperationSuccessful"; // ds.delete("id = ID"); // results = ds.Tables[0].AsEnumerable() // .Select(row => new Registrationform // { // Id = 0, // Name = null, // Age = 0, // EMailId = null, // phNumber = null) // }).ToList(); } catch { Msg = "DeleteOperationFailed"; } return Msg; } Here is my stored procedure
ALTER procedure [dbo].[DeleteStudentDetails] as begin delete from Registrationform where ID = ID end
DeleteStudentDetailsstored proc look like? What doesdatabase.ExecuteDataSetdo? The fact that you're not using theIDparameter makes it hard for me to see how you'd expect it to know which row to delete...