TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ramco Ramco
436
3.4k
546.4k
Record not getting deleted
Jun 2 2021 5:45 AM
Hi
Below is the code. Secondly i in ExecuteNonQuery returns -1.
if @Action='D'
Begin
--Update Location set IsActive = 'N' where Id = @Id;
Delete from Location where Id = @Id;
End
*********************
in **Id** it shows value as CHD\n
public int Delete(string Id)
{
int i;
using (SqlConnection con = new SqlConnection(cs))
{
con.Open();
SqlCommand com = new SqlCommand("sp_Location", con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@Id", Id);
com.Parameters.AddWithValue("@Action", "D");
i = com.ExecuteNonQuery();
}
return i;
}
**********************
In LocId it shows Chd
function Delete() {
var LocId = $("#hiddenId").val();
alert(LocId);
$.ajax({
url: "/Location/Delete",
data: { Id: LocId },
type: "POST",
dataType: "json",
success: function (result) {
$("#row_" + LocId).remove();
$('#DeleteModal').modal('hide');
clearTextBox();
$.notify(result.message, {
globalposition: "top center",
className: "success"
})
},
error: function (errormessage) {
alert(errormessage.responseText);
}
});
|
Reply
Answers (
4
)
Disable Delete Button
Login User data comes from Database