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.
This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. By joining today you can post your own programming questions, respond to other developers questions, and eliminate the ads that are displayed to guests. Well, couldn't get exactly what you are asking for?
Then use something like the below: Edit - the first parameter here should match the field in your model which you want to add the error too.
IF NOT EXISTS (SELECT * FROM Table_Name WHERE Column Name= @Column Name) BEGIN SET @Error Msg [email protected] Name ' Already Exists' RAISERROR (@Error Msg,11,1) return END Hope It Helps..
Click Dim mp Label As Label = Nothing Dim txt VId As Text Box = Nothing Dim txt Desc As Text Box = Nothing Dim lnk Ins Save As Link Button = Nothing Try grd Plu Grp. Add("onbeforedeactivate", "return Check ID('" grd Plu Grp.
Show Footer = True Bind PLUGrp Details SQL() mp Label = CType(Master.