Create proc similar to the following & check the return value and show the message accordingly..
Create Procedure Proc_Name
(
@EMailAdress varchar(50) = null,
}
AS
IF EXISTS (SELECT UserID FROM E-MAIL WHERE EMailAdress = @EMailAdress)
BEGIN
return 0
END
ELSE
BEGIN
INSERT INTO E-MAIL (UserID,EMailAdress,Description) VALUES (UserID,@EMailAdress,@Description)
return 1
END
In the code, check for the return value something like...
int returnValue = (int) comm.ExecuteScalar();