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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:35:10+00:00 2026-06-07T05:35:10+00:00

For a ‘new record’ site I have a FormView attached to an SqlDataSource .

  • 0

For a ‘new record’ site I have a FormView attached to an SqlDataSource. The user inputs the data and the InsertCommand has the SQL INSERT statement. The thing is that I want to do other queries as part of the initialization, and these queries involve other tables.

Basically I want to execute all these queries when the user clicks the “Insert” button.
The first INSERT gets the values from the input form, but the other three are always the same.

INSERT INTO proceso (nombreProceso, macroProceso, analista_id)
VALUES (@nombreProceso,@macroProceso,@analista_id)
INSERT INTO marcador_progreso (marcador_id,state,proceso_id) VALUES (1,'False',@id)
INSERT INTO marcador_progreso (marcador_id,state,proceso_id) VALUES (2,'False',@id) 
INSERT INTO marcador_progreso (marcador_id,state,proceso_id) VALUES (3,'False',@id) 

When I run this, the first statement apparently gets executed (i.e a new proceso record gets inserted) but the other 3 INSERTs do not. How should I proceed to solve this?

The SqlDataDource contains the id parameter

 <InsertParameters>
     ... a few parameters...
     <asp:Parameter Name="id" />
</InsertParameters>
  • 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-07T05:35:12+00:00Added an answer on June 7, 2026 at 5:35 am

    Please correct me if I’m wrong but it seems to me you want the @id thing to be the ID of the row just inserted into proceso. At least that seems to follow from the corresponding marcador_progreso column’s name (proceso_id). If my surmise is correct then you don’t need a parameter called id. The @id in your query should be a local variable initialised by the ID of the row inserted by the first INSERT.

    If proceso‘s ID is an integer IDENTITY column, then change your script like this:

    INSERT INTO proceso (nombreProceso, macroProceso, analista_id)
    VALUES (@nombreProceso,@macroProceso,@analista_id);
    
    DECLARE @id int;
    SET @id = SCOPE_IDENTITY();
    
    INSERT INTO marcador_progreso (marcador_id,state,proceso_id) VALUES (1,'False',@id);
    INSERT INTO marcador_progreso (marcador_id,state,proceso_id) VALUES (2,'False',@id);
    INSERT INTO marcador_progreso (marcador_id,state,proceso_id) VALUES (3,'False',@id);
    

    And remove the id parameter.

    The SCOPE_IDENTITY() function returns the last value inserted into an IDENTITY column of any table in the current scope of execution.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I have the following tasks in my deploy.rb namespace :unicorn do desc stop unicorn
The problem with unsigned char. I am reading a PPM image file which has
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I would like to count the length of a string with PHP. The string

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.