|
Subject:
|
Validate chekc
|
|
Posted By:
|
Raul
|
Post Date:
|
2/6/2004 3:08:47 PM
|
How can I make it so that when a user enters in an id number a routine runs that check if there is already an existing ID here is my stored proc that checks this...
CREATE PROCEDURE IDEXISTCHECK @ID varchar(30) AS
BEGIN DECLARE @Exist int IF EXISTS (SELECT * FROM MYTABLE WHERE ID = @ID ) SELECT @Exist = 1 ELSE SELECT @Exist = 0 PRINT (@Exist) RETURN (@Exist)
END
In my ASP form is there a way I can call this to run then send some type of alert? If there a a better method of doing this I'll except any suggestions I would like an alert to fire before changes get posted to the stored proc that commits the insert. Please Help. 
|
|
Reply By:
|
joefawcett
|
Reply Date:
|
2/7/2004 8:30:52 AM
|
Well using server side code you would create a command object, execute it and check the return value parameter. You should comment out the print statement or set nocount on to avoid generating extra recordsets. From client side code you would need to use something like msxml2.xmlhttp class to call a web page with the above server code in it. This would return an xml formatted response of true or false.
--
Joe
|
|
Reply By:
|
Raul
|
Reply Date:
|
2/9/2004 11:25:50 AM
|
Thanks do you have by any chance any code examples?
|
|
Reply By:
|
Raul
|
Reply Date:
|
2/9/2004 11:35:16 AM
|
Well basically my form allows the user to insert new records, before the values get posted to the next form I want to alert to fire, kinda like when he/she hits the submit button.
|
|
Reply By:
|
Raul
|
Reply Date:
|
2/9/2004 6:59:29 PM
|
There is not some way to just call an sp if it returns 1 then fire the error?
|