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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:07:06+00:00 2026-05-23T03:07:06+00:00

I have an sql statement that I posted on this site, and I applied

  • 0

I have an sql statement that I posted on this site, and I applied in my website that works and inserts users name and information into the database soon after the user presses the submit button.

This however doesnt happen when I set the the submit’s buttons PostBackUrl property. When I do this, no data is inserted, and the whole function that holds the execution of the insert statement seems to be skipped (as I tried to make a mistake on purpose,,and no exception was thrown).

How can i make the the postBackUrl work, so that data will have the time to be inserted?

working sqlStatment:

 insertCommand.Append("DECLARE @TopicsId int; INSERT INTO Topics(Theme,Topics,Date)");
    insertCommand.Append("VALUES(@topic,@subTopic,GETDATE())");
    insertCommand.Append("SET @TopicsId = SCOPE_IDENTITY()");

    insertCommand.Append(" INSERT INTO Threads(UsersID,TopicsID,Date,ThreadTitle,ThreadParagraph,ThreadClosed,Views,Replies,PageNumber)");
    insertCommand.Append(" SELECT @uniqueIdentifier,@TopicsID,GETDATE(),@questionTitle,@questionParagraph,0,0,0,FLOOR(Count(t.TopicsID)/20)");
    insertCommand.Append(" FROM Threads AS d INNER JOIN Topics AS t ON d.TopicsID=t.TopicsID");

working when:

<asp:Button ID="sendButton1" runat="server" Text="שלח" Width="60px" 
            onclick="sendButton1_Click"  />

non working sqlStatement when:

<asp:Button ID="sendButton1" runat="server" Text="שלח" Width="60px" 
            onclick="sendButton1_Click" PostBackUrl="~/AnswerQuestion.aspx" />
  • 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-05-23T03:07:06+00:00Added an answer on May 23, 2026 at 3:07 am

    This will cause cross-page postback. It will post the current page to the provided URL in the button’s PostbackURL property when the Button control is clicked. Your button Click event will not be triggered in this case.

    For Details please check from MSDN

    EditL Why not attempt this simply, like…

    protected void Button1_Click(object sender, EventArgs e)
    {
    ///.....Your Code.....
    insertCommand.Append("DECLARE @TopicsId int; INSERT INTO Topics(Theme,Topics,Date)");
    insertCommand.Append("VALUES(@topic,@subTopic,GETDATE())");
    insertCommand.Append("SET @TopicsId = SCOPE_IDENTITY()");
    
    insertCommand.Append(" INSERT INTO Threads(UsersID,TopicsID,Date,ThreadTitle,ThreadParagraph,ThreadClosed,Views,Replies,PageNumber)");
    insertCommand.Append(" SELECT @uniqueIdentifier,@TopicsID,GETDATE(),@questionTitle,@questionParagraph,0,0,0,FLOOR(Count(t.TopicsID)/20)");
    insertCommand.Append(" FROM Threads AS d INNER JOIN Topics AS t ON d.TopicsID=t.TopicsID");
    
     ///..At the end add this......
     Response.Redirect("~/AnswerQuestion.aspx");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this SQL statement that works but takes a while to execute I
I have a sql statement that uses Difference => http://msdn.microsoft.com/en-us/library/ms188753.aspx I do this in
I have the following SQL statement (that is intended for SQL Server): INSERT INTO
I have a SQL statement that is something like this SELECT t1.* CASE WHEN
I have a simple SQL Statement that works perfectly in SQL Server: DECLARE @ID
So I have an SQL statement looks like this SELECT T1.NAME, COUNT(T2.VALUE) AS numInstances
I have an SQL statement that works SELECT * FROM eventsTable WHERE columnName='Business' I
I have a SQL Statement that works as I want. select COUNT(*), MIN(emailed_to)from email.email_archive
I have a SQL statement that looks like: SELECT [Phone] FROM [Table] WHERE (
I have an SQL statement that I'm executing through OleDb, the statement is something

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.