Return Date From SP

  • Hi,

    I am using .Net to update a table in SQL Server 2000. One of the columns in the table is LastUpdateDate which is as it says! My stored procedure sets the datetime to go in here using GetDate(). My question is how do I get this value back (without having to read from the table again, if poss.) I tried using an output parameter but I get an error. This is the vb.net code and a bit of the sp.

    'Add parameter for returning UpdateDate: @UpdateDate

    dim prmUpdateDate as New SQLParameter()

    prmUpdateDate.Direction = ParameterDirection.Output

    prmUpdateDate.ParameterName = "@UpdateDate"

    cmdUpdate.Parameters.Add(prmUpdateDate)

    ...

    Stored Proc

    ...

    As

    DECLARE @UpdateDate DateTime

    SET @UpdateDate = GetDate()

    UPDATE CAPA_MAIN ....LastModifyDate = @UpdateDate...

    RETURN

  • Create proc .... @UpdateDate output = GetDate()

    then supply a null value when you create this parameter... You should be fine this fine.

  • Perfect!

    Thanks again for your help (for the second time today!!)

  • HTH, again .

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply