Results 1 to 2 of 2

Thread: sqldatasource, OUTPUT clause

  1. #1

    Thread Starter
    Frenzied Member met0555's Avatar
    Join Date
    Jul 2006
    Posts
    1,385

    sqldatasource, OUTPUT clause

    Hi,

    On my page i have a sqldatasource object, I already filled the select, update... queries and currently it works fine. But i recently learned about the OUTPUT SQL clause, which is able to return the last inserted data ID .

    Code:
    INSERT INTO aa
               )
               
               
       OUTPUT INSERTED.ID AS 'New User ID'
       
       
              values
              
             ('haha') 
               
    GO
    this code works fine when i run it on SQL direct, but on my sqldatasource object, i'm not sure how to retrieve the return value? But i'm not sure how to get the return value just after doing the insert command.
    currently to insert data with mysqldatasource i use
    SqlDataSource1.InsertParameters("email").DefaultValue = Emailtextbox.Text
    SqlDataSource1.Insert()
    thx
    Last edited by met0555; Jul 2nd, 2012 at 09:55 AM.

  2. #2

    Thread Starter
    Frenzied Member met0555's Avatar
    Join Date
    Jul 2006
    Posts
    1,385

    Re: sqldatasource, OUTPUT clause

    Any tips?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width