Well, that can't be done using javascript, for that you have to implement a check in your stored procedure, an e.g. can be as below:
IF EXISTS(SELECT TOP 1 1 FROM products WHERE productname = @productname)
BEGIN
RETURN -2
END
The above means that if product name already exists the SP will return -2, then you can check the return code in your programming, and display the message for duplicate product name if return code is -2. Do let us know if you need a sample SP for inserting a new product in products table keeping in mind duplicate values.
Regards
Mike
Don't expect too much, too soon.
|