Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
I want to use facebook like query for my website..

I have an e-commerce web website. and this website has many products.
When a user clicks on a product and then are show a 'like' button.
I want to do when user click on like button by his own email id then product should be like by particular id.

Thank you very much in advance
Posted
Updated 12-Jun-12 0:05am
v2
Comments
Reza Ahmadi 12-Jun-12 6:07am    
Your question is not clear. Describe more and clarify your exact issue.
yatendra parashar 5-Sep-12 5:36am    
this solution is not right

1 solution

Create tabke like

id	int	
likedis	bit	
productid	int	
userid	varchar(150)

make unique constraints on (productid,userid)


Create stored procedure like
SQL
ALTER PROCEDURE [dbo].[inslike]
	
	
	
	@aid int,
	@userid varchar(150)
	
	as
BEGIN
begin try
	 BEGIN TRANSACTION 
	insert into tbllike (likedis,productid,userid) values(1,@aid,@userid);
	update tblProduct set like1=like1+1 where ID=@aid;
	Commit
	end try
	begin catch
	ROLLBACK
	end catch
	
END


on like buttonclick
C#
SqlCommand cmd = new SqlCommand();
                cmd.Connection = GetConnection();
                cmd.CommandText = "inslike";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@aid", int.Parse(e.CommandArgument.ToString()));
                cmd.Parameters.AddWithValue("@userid", Session["userid"].ToString());
                cmd.ExecuteNonQuery();
                cmd.Connection.Close();
                getData();
 
Share this answer
 
Comments
Rakesh Tailor 12-Jun-12 6:31am    
thanks for help..
But I want to do that when user click on like button the go to facebook site login page and after login than liked successfully...
uspatel 12-Jun-12 6:59am    
See this article
http://www.codeproject.com/Tips/353983/Add-Facebook-Like-Button-To-Website

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900