create proc Authenticate(@Pname varchar(50),@categoryname varchar(55)) as begin declare @productcount int declare @categorycount int set @productcount=(select count(*) from Product where Pname=@Pname ) set @categorycount=(select count(*)from Category where CategoryName=@categoryname) if(@productcount!=0 @categorycount!=0) return 1 else return 0 end
SqlConnection con = new SqlConnection(Constr); SqlCommand cmd = new SqlCommand("Authenticate",con); cmd.Parameters.AddWithValue("@Pname", productname); cmd.Parameters.AddWithValue("@CategoryName", categoryname); con.Open(); int ctr = (int)cmd.ExecuteScalar(); con.Close(); return ctr;
SqlParameterCollection.AddWithValue
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)