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

  • SEARCH
  • Home
  • 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 7931225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:39:16+00:00 2026-06-03T20:39:16+00:00

I have an asp.net wizard control in my web application I am calling a

  • 0

I have an asp.net wizard control in my web application I am calling a stored procedure from code behind to insert data into database. Executing the proc in SSMS works fine and I had gotten this block to work once before and made changes (i unfortunately cannot remember which changes i made). My problem is that when the next button is clicked no errors are thrown and also no data is written to the database. I have tested by adding exception into the cnx2 try block and the exceptions were thrown so I know the code is executing to the place I want it to but it is still not inserting. Any help is appreciated Thank you. And please if there is any information i can add that may help let me know

     protected void onNextButtonClick(object sender, EventArgs e)
    {
        if (Wizard1.ActiveStepIndex.Equals(1))
        {
            page1Submit();
        }
        else if (Wizard1.ActiveStepIndex.Equals(2))
        {
            page2Submit();
        }
        else if (Wizard1.ActiveStepIndex.Equals(3))
        {
            page3Submit();
        }
        else if (Wizard1.ActiveStepIndex.Equals(8))
        {
            page8submit();
        }
    }
    protected void page1Submit()
    {
        string hispanic;
        if (cbIsHispanic.Checked)
        {
            hispanic = "1";
        }
        else
        {
            hispanic = "0";
        }
        bool newReport = true;
        SqlConnection cnx = new SqlConnection(server);
        SqlCommand cmd = new SqlCommand("[ReportCheckExists]", cnx);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@reportNumber", dReportNumber.Text.ToString());
        try
        {
            cnx.Open();
            int rowCount = Convert.ToInt32(cmd.ExecuteScalar());
            cnx.Close();
            if (rowCount > 0)
            {
                newReport = false;
            }

        }
        catch (Exception ex)
        {
            throw new Exception("Error executing MyProcedureName.", ex);
        }
        if (newReport)
        {
            SqlConnection cnx2 = new SqlConnection(server);
            SqlCommand cmd2 = new SqlCommand("[NewReport]", cnx2);
            cmd2.CommandType = CommandType.StoredProcedure;
            cmd2.Parameters.AddWithValue("@reportNumber", dReportNumber.Text.ToString());
            try
            {
                cnx.Open();
                cmd.ExecuteNonQuery();
                cnx.Close();

            }
            catch (Exception ex)
            {
                throw new Exception("Error executing MyProcedureName.", ex);
            }  
        }
        else
        {
            string strJavaScript = "<script language = javascript type=text/Javascript> alert('That report number already exists. If you need to modify a report select it from the main menu or enter the report number again.')</script>";
            this.Page.RegisterClientScriptBlock("Key4", strJavaScript);
            Wizard1.ActiveStepIndex = 0;

        }
    }
  • 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-03T20:39:18+00:00Added an answer on June 3, 2026 at 8:39 pm

    It’s probably because you are executing the cmd command, and not cmd2 in your second try catch block

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

does anyone have a link to some code for a wizard control in asp.net
as you have seen before we have asp.net wizard componant for web application Is
i have read somewhere about using layout template in asp.net wizard control but when
I have an ASP.NET web application that takes user input across several forms. Sort
I have an ASP.NET web application where a portion of it needs to run
I have an ASP.NET wizard control where I loop back, wiz.MoveTo(wiz.WizardSteps[0]) , to the
I've tried a demo on how to use the ASP.NET Wizard web Control. Now
I have an ASP.NET page with a Wizard control containing several pages of form
I have an ASP.NET site that uses a standard, wizard created login control. I
I'm using ASP.NET, and in a Wizard control I have radio buttons where if

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.