ER sandeep chourasia sandeepchrs@yahoo.com (on facebook) http://www.aspnetcodes.com/
IF Not Exists(SELECT 1 FROM UserTable WHERE UserName = @userName) Begin INSERT INTO UserTable (UserName) VALUES (@userName) End
Himanshu Manjarawala Sr. Software Engineer@AutomationAnywhere http://fieredotnet.wordpress.com/
create proc [dbo].[sp_InsPersonInfo] @pEmail varchar(50) as declare @Count as int set @Count=(select count(id) from Persons where PersonEmail=@pEmail) select @Count as DuplicateEmail if @Count=0 begin insert into Persons values(@pEmail) end
protected void btnSubmit_Click(object sender, EventArgs e) { BAL = new PersonBusinesslayer(); ds = new DataSet(); ds=BAL.Insert(txtEmail.Text); int Count; Count = Convert.ToInt32(ds.Tables[0].Rows[0]["DuplicateEmail"].ToString()); if (Count > 0) { string strjscript = "<script language='javascript'> alert('Email id already exists ');</script>"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "myscript", strjscript); } }
Join Hands Change lives Thanks & Regards Straight Edge Society
Thanks, Sanjay
sriram
DECLARE @Count int SELECT @Count = Count(AutoID) FROM UserTable WHERE UserName = @userName IF @Count = 0 BEGIN INSERT INTO UserTable (UserName) VALUES (@userName) END
Regards, Raja, USA
Login to post response