multi page record

Last post 10-15-2006 3:22 AM by amersafi. 2 replies.

Sort Posts:

  • multi page record

    10-12-2006, 5:06 AM
    • Member
      237 point Member
    • amersafi
    • Member since 07-13-2006, 7:45 AM
    • Posts 88

    i have two pages  the first one the users enter the information the record well be creadted in the database and the second page the user must enter another information to the same record of the first page .

    how can i get the id auto number of record from the database in the second page

  • Re: multi page record

    10-12-2006, 11:46 AM
    • Contributor
      5,887 point Contributor
    • sbyard
    • Member since 03-26-2003, 3:42 AM
    • North Yorkshire - England
    • Posts 1,187

    depends exactly what you are doing.

    What I do in these cases is to have a helper function in a helper class.  THis can create a connection to the database, open an SqlCommand, then perform an ExecuteScalar before cleaning up and returning the new Id (returns 0 if an error)

    Now that I have the ID, further updating is possible

    I also use a single Stored Procedure for Insert/update and check for either 0 or null value for the Id being passed - either method is OK - just set the parameter to have a default value and don't set the SqlCommand parameter when creating the parameter list.

    If parameter is present, then it must be an update, otherwise it is an insert

    If it was easy, everybody would be doing it.
  • Re: multi page record

    10-15-2006, 3:22 AM
    • Member
      237 point Member
    • amersafi
    • Member since 07-13-2006, 7:45 AM
    • Posts 88

    thank u

    i want this

    select @@identity

    thank u agin

Page 1 of 1 (3 items)