Validation on database update

Results 1 to 2 of 2

Thread: Validation on database update

  1. #1
    Join Date
    Dec 1969

    Default Validation on database update

    &nbsp;<BR>I would like this script to validate a form basing on whether a database update was successful or not. It validates items selected in a dropdownlist and the form is valid if the update is successful. Its not working, what am I doing wrong? <BR>&#060;script runat="server"&#062; <BR>void serverSelectsegment(object source, ServerValidateEventArgs args) <BR>{ <BR>try <BR>{ <BR>args.IsValid = (cmdGoldupdate.Parameters["@RETURN_VALUE"].Value == "1" ); <BR>} <BR><BR>catch <BR>{ <BR>args.IsValid = false; <BR>} <BR>} <BR>&#060;/script&#062; <BR><BR>This is the stored procedure that does the update <BR>CREATE PROCEDURE dbo.sp_Goldupdate <BR>( <BR>@timer datetime, <BR>@org nvarchar(50), <BR>@message nvarchar(240), <BR>@url nvarchar(50), <BR>@email nvarchar(50) <BR><BR>) <BR>AS <BR><BR><BR><BR>SET NOCOUNT ON; <BR><BR>DECLARE @RETURN_VALUE int <BR><BR>BEGIN TRAN <BR><BR>UPDATE Gold SET org = @org, message = @message, url = @url, email = @email WHERE (timer = @timer) AND ( org IS NULL) <BR><BR><BR><BR>SELECT @RETURN_VALUE = @@Error <BR><BR>IF @RETURN_VALUE != 0 <BR>BEGIN <BR>ROLLBACK TRAN <BR>RETURN(1) <BR>END <BR>ELSE <BR>BEGIN <BR>COMMIT TRAN <BR>RETURN(0) <BR>END <BR>GO <BR><BR>PS: Do you by any chance know how I can do both programatically i.e. without using scripts in html, but having code in the source file?My development environment is

  2. #2
    Join Date
    Dec 1969

    Default *** Reposted from Yesterday!

    &#060;nothing to say &#039;cept read the responses from yesterday!

Posting Permissions

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