Click here to Skip to main content
15,906,229 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Count every Buton clicks to store values to database in asp.net C#
Posted
Comments
manak chand 25-Feb-15 2:21am    
Can you explain the scenario..why you need to save button count in database..
Member 10918596 25-Feb-15 2:24am    
autually i put yes/no in web page.when i clik yes,this store to database.
.when i clik NO,this also store to database

Quote:
autually i put yes/no in web page.when i clik yes,this store to database.
.when i clik NO,this also store to database
Then store "Yes" or "No" in that Column. No need to put mouse clicks there.
 
Share this answer
 
Comments
[no name] 25-Feb-15 3:39am    
Nice answer Tadit Dash :)
Hey Rajeesh, Thanks man. :)
[no name] 25-Feb-15 3:41am    
5+ Tadit Dash :)
Thanks a lot bro. :)
You would be having Yes and No count columns in database.. on click of button just hit the table with below mentioned Update Query.

SQL
If (@ButtonType == 'Y')
begin
    select @Count = Max(YesCountColumn) from Table
    update table 
    set YesCountColumn = @count + 1
end
else
    select @Count = Max(NoCountColumn) from Table
    update table 
    set NoCountColumn = @count + 1
begin
end

Please tell me your table structure.. So that I can better give you solution.. I have build query as per below table structure
Create Table table(YesCountColumn int, NoCountColumn int)
 
Share this answer
 
if you are planning to catch user activities
log. call below method on every button click() event

void updated(string src)
{

//insert into table(column) values(src)
}
 
Share this answer
 
Hi,

Ref this : Count every Buton clicks
 
Share this answer
 

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