Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8037775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:01:22+00:00 2026-06-05T03:01:22+00:00

I have an event that fires on a button click that calls a stored

  • 0

I have an event that fires on a button click that calls a stored procedure that deletes the selected row from the database.

In debugging this I have already hard coded the stored procedure with an id to make sure the delete was working on SQL side so I wont post the stored procedure. I also went into my page and on selecting the record to delete made sure that the hidden field was being set to the id of the record.

When I click I see the post back occur so I see the button firing, and it may be something small and stupid with my code or a permissions issue I am not aware of or where to look for.

The parameter for the stored procedure is an integer, and I am not hitting the catch or throwing errors of any kind the data just is not being deleted.

Thanks for any help on this issue as always it is much appreciated.

This is the code that fires when the button is clicked.

if (isAdmin)
{
    SqlConnection cnx = new SqlConnection(server);
    SqlCommand cmd = new SqlCommand("STOREDPROCNAME", cnx);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@VARIABLEFORPROC", Convert.ToInt16(hiddenfield1.Value.ToString()));

    try
    {
       cnx.Open();
       cmd.ExecuteNonQuery();
       cnx.Close();
    }
    catch (Exception ex)
    {
       throw new Exception("Error executing MyProcedureName.", ex);
    }
}

fillDataGrids();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:01:24+00:00Added an answer on June 5, 2026 at 3:01 am

    The SQL Int type maps to the C# Int32 type. It’s possible that you’re getting data loss during your conversion. Try replacing

    cmd.Parameters.AddWithValue("@VARIABLEFORPROC", Convert.ToInt16(hiddenfield1.Value.ToString()));
    

    with

    cmd.Parameters.AddWithValue("@VARIABLEFORPROC", Convert.ToInt32(hiddenfield1.Value.ToString()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have button, which fires an event, that deletes a record from the database.
I have an autocomplete event that fires correctly once a value is selected. I
I have a 3 dropdownlist control with a selectedindexchanged event that fires correctly. However,
I have an asynchronously running Task that fires an event when it's completed like
I have an event on a page that I need to fire from a
I have a search page that loads results. Each row has a Delete button
Having problems with IE8... I have a button that onclick fires the showImageBrowser() function.
I am using HTML5 for uploading files. I have a button click event attached
I have a button on an ascx control that calls a method on the
I want to have a generic event that I can fire that will take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.