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 8052123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:28:07+00:00 2026-06-05T07:28:07+00:00

the code below accepts the text in the form and insets it into the

  • 0

the code below accepts the text in the form and insets it into the table.i wanted to it to add to the table and redirect to the same page after displaying the message “data has been added”.But the problem is that it is getting redirected to the target page but not displaying the message.im guessing that is because the cmd.ExecuteQuery(); is generating a response and is getting redirected…

but i want it to show the message.
what changes should i do.thanks in advance

protected void Button2_Click(object sender, EventArgs e)
{

    string v = System.Configuration.ConfigurationManager.ConnectionStrings["harish"].ConnectionString;
    con = new OracleConnection(v);
    con.Open(); 
    string query="insert into leave_module1 values(:name,:desig,:srno,:tol,:compdates,:fd,:td,:nod,:remarks)";
    OracleCommand cmd = new OracleCommand(query, con);
    //OracleCommand.BindByName = true;
    try
    {
        cmd.Parameters.Add(":name", OracleType.VarChar, 50).Value = DropDownList2.Text;
        cmd.Parameters.Add(":desig", OracleType.VarChar, 30).Value = TextBox10.Text;
        cmd.Parameters.Add(":srno", OracleType.Number, 8).Value = TextBox8.Text;
        cmd.Parameters.Add(":tol", OracleType.VarChar, 10).Value = DropDownList1.Text;
        cmd.Parameters.Add(":compdates", OracleType.VarChar, 30).Value = TextBox9.Text;
        cmd.Parameters.Add(":fd", OracleType.DateTime).Value = TextBox3.Text;
        cmd.Parameters.Add(":td", OracleType.DateTime).Value = TextBox4.Text;
        cmd.Parameters.Add(":nod", OracleType.Number, 3).Value = TextBox5.Text;
        cmd.Parameters.Add(":remarks", OracleType.VarChar, 50).Value = TextBox7.Text;
        cmd.ExecuteNonQuery();
        ClientScript.RegisterStartupScript(Page.GetType(), "validation",
         "<script language='javascript'>alert('The Data has been added')</script>");
        Response.Redirect("Default2.aspx");


    }
    catch
    {

        Label13.Visible = true;           

    }

    con.Close();    

}
  • 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-05T07:28:08+00:00Added an answer on June 5, 2026 at 7:28 am

    Don’t use Response.Redirect.

    Just use javascript:

    ClientScript.RegisterStartupScript(Page.GetType(), "validation", 
         "<script language='javascript'>alert('The Data has been added'); window.location='default2.aspx';</script>");         
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code below is working well as long as I have class ClassSameAssembly in same
The code below create one circle inside the windows form. This code compiled without
Below is the code of a Form that I am creating. The CSS code
The code below converts text for characters with accents. But it also converts the
Code below: [HttpGet] public ActionResult Edit(string id=) { // ... } [HttpPost] public ActionResult
Code below, not sure what i'm doing wrong. It is an employee database. The
Code below is used to save PostgreSql database backup from browser in Apache Mono
The code below shows 2 Foo templates each with 2 default parameters, Foo1 has
My code below seems logical however i don't know why the sorting doesn't work
The code below from http://www.scalaclass.com/book/export/html/1 to do matrix dot product. I can't understand the

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.