when user starts looking at items and if some user gets fascinated by an items, then he clicks on like button, which from backend increment the
[Likes] column of that [ItemName] by 1...
i want a mechanism where your suggested system will query from Items table and
"select top 3 max(likes) from items" and insert those three
[ItemNames] in table Poll and set other column values as
PollDuration = 7 days, DaysPassed = 0, ActivationDate = 1Dec2012... since today is 25Nov2012, now on one day when Server Date gets 1Dec2012, your suggested system will automaticaly display this poll in webpage...
on 2Dec2012, your suggested system will automatically set DaysPassed = 1 against that display poll, similarly on 8Dec2012 when
DaysPassed = 7, your suggested system will automatically finish this poll and update
Status = completed against this poll and start looking for new
"select top 3 max(likes) from items"
i tried my best to describe my scenario in detail... your urgent reply will make a difference in problem i am facing... i don't no how and where to implement this... either on database level or on webpage level...
wavemaster, i thankful that you replied... i fully understand your said sample & i already have gone through it... bt this cant be implemented in my case... i already made a very huge web application... and the thing i am asking is just a small tiny portion
in that enormous site... if i go for WebMatrix, i need to develop everything as per its templates...
correct me if i am wrong...
i guess i need to write stored procedure / trigger / sql job to automatically initiate the entire process... but i am not sure about it... still searching google for my solution...
thanks again for showing your deep concerns, i am obligued...
I didn't get your point of above query, max(like) will return only one record, you could use select top 3 ItemName from Item order by likes desc to get that three records. Create sql job to execute the rest steps on time.
declare @Poll table([Question] varchar(10), [Option1] varchar(10), [Option2] varchar(10),
[Option3] varchar(10), [Result] varchar(10), [PollDuration] varchar(10), [DaysPassed] varchar(10),
[ActivationDate] varchar(12))
declare @Items table([ItemName] varchar(10), [Likes] varchar(10), [Description] varchar(10))
insert into @Items
SELECT 'NAME1','1','aaa' UNION ALL
SELECT 'NAME2','2','aaa' UNION ALL
SELECT 'NAME3','3','aaa' UNION ALL
SELECT 'NAME4','4','aaa' UNION ALL
SELECT 'NAME5','5','aaa'
insert into @Poll (Question,PollDuration,DaysPassed,ActivationDate)
select top 3 ItemName,'7','0',convert(varchar(12),DATEADD(day,6,getdate()),106) from @items
order by Likes desc
select * from @poll
Dizki
Member
38 Points
25 Posts
URGENT REPLY - Automatically Display Polls
Nov 25, 2012 02:40 PM|LINK
hi to all,
i am new to Asp.Net, i am stuck in a problem which is related to polling... i don't no how and where to implement this...
my scenario is as follows, in my database, i ve few tables
(First table) => Table Name : Poll, Columns : [Question], [Option1], [Option2], [Option3], [Result], [PollDuration], [DaysPassed], [ActivationDate]
(Second table) => Table Name : Items, Columns : [ItemName], [Likes], [Description]
when user starts looking at items and if some user gets fascinated by an items, then he clicks on like button, which from backend increment the [Likes] column of that [ItemName] by 1...
i want a mechanism where your suggested system will query from Items table and "select top 3 max(likes) from items" and insert those three [ItemNames] in table Poll and set other column values as PollDuration = 7 days, DaysPassed = 0, ActivationDate = 1Dec2012... since today is 25Nov2012, now on one day when Server Date gets 1Dec2012, your suggested system will automaticaly display this poll in webpage...
on 2Dec2012, your suggested system will automatically set DaysPassed = 1 against that display poll, similarly on 8Dec2012 when DaysPassed = 7, your suggested system will automatically finish this poll and update Status = completed against this poll and start looking for new "select top 3 max(likes) from items"
i tried my best to describe my scenario in detail... your urgent reply will make a difference in problem i am facing... i don't no how and where to implement this... either on database level or on webpage level...
So Kindly Mark It As
ANSWER
wavemaster
Participant
1293 Points
1129 Posts
Re: URGENT REPLY - Automatically Display Polls
Nov 25, 2012 03:09 PM|LINK
WebMatrix seems like an elegant solution for your problem.
Dizki
Member
38 Points
25 Posts
Re: URGENT REPLY - Automatically Display Polls
Nov 25, 2012 03:15 PM|LINK
hi wavemaster...
thanks for your reply... can you please guide me a solution / sample via WebMatrix... i no nothing about WebMatrix...
So Kindly Mark It As
ANSWER
Dizki
Member
38 Points
25 Posts
Re: URGENT REPLY - Automatically Display Polls
Nov 25, 2012 05:00 PM|LINK
no i guess WebMatrix is diff thing...
So Kindly Mark It As
ANSWER
Dizki
Member
38 Points
25 Posts
Re: URGENT REPLY - Automatically Display Polls
Nov 26, 2012 07:50 AM|LINK
can anybody answer my question... ???
So Kindly Mark It As
ANSWER
wavemaster
Participant
1293 Points
1129 Posts
Re: URGENT REPLY - Automatically Display Polls
Nov 26, 2012 12:00 PM|LINK
Check out a few tutorials for WebMatrix! Google is your friend.
here is one I like, it has helped me a lot!
Dizki
Member
38 Points
25 Posts
Re: URGENT REPLY - Automatically Display Polls
Nov 26, 2012 04:37 PM|LINK
wavemaster, i thankful that you replied... i fully understand your said sample & i already have gone through it... bt this cant be implemented in my case... i already made a very huge web application... and the thing i am asking is just a small tiny portion in that enormous site... if i go for WebMatrix, i need to develop everything as per its templates...
correct me if i am wrong...
i guess i need to write stored procedure / trigger / sql job to automatically initiate the entire process... but i am not sure about it... still searching google for my solution...
thanks again for showing your deep concerns, i am obligued...
So Kindly Mark It As
ANSWER
Chen Yu - MS...
All-Star
21600 Points
2493 Posts
Microsoft
Re: URGENT REPLY - Automatically Display Polls
Nov 29, 2012 07:38 AM|LINK
Hi,
I didn't get your point of above query, max(like) will return only one record, you could use select top 3 ItemName from Item order by likes desc to get that three records. Create sql job to execute the rest steps on time.
You could follow this article to create a SQL job: http://msdn.microsoft.com/en-us/library/ms190268.aspx#TsqlProcedure
Feedback to us
Develop and promote your apps in Windows Store