tags:

views:

1675

answers:

3

I'm attempting to create my first "real" C# application - a small pet project to help schedule peer reviews at work.

Due to the insane amount of process/bureaucracy involved in implementing anything new - as well as the fact that I'm doing this away from managements eyes, on my own time, for the time being - I'm going to be writing this with an MS Access MS Jet Engine backend (i.e. an access mdb file) due to restrictions on how I can deploy this application to my co-workers.

My question is: how do I poll the database intermittently to grab updates (new requested reviews, messages from other developers requesting info, etc.) from the database?

Should I just drop a Timer on each form that needs the info and refresh everything when an update has occurred?

Edit:
I'm looking for advice specifically on how to implement the timer. I can't install things on workstations, I don't have access to servers (outside of storage space), and I can't host this myself due to the company's security requirements since our client has ridiculous DoD restrictions.

I guess I've figured this out anyway, since the "timer on form" solution works just fine (I don't know what I was thinking when I said I wanted a secondary solution for a CLI version as it clearly isn't needed.. it's very late).

Thanks!

A: 

develop your application as a aspnet MVC app. this way it's a web site and developers can simply refresh pages to get the latest results. this will help you in many ways: no polling, no access, web interface (very handy), [too many to mention]

start here - http://www.asp.net/learn/mvc-videos/video-395.aspx
EDIT: more links:
(these are great vids)
* http://www.asp.net/learn/mvc-videos/video-396.aspx
* http://www.asp.net/learn/mvc-videos/video-360.aspx
* http://www.asp.net/learn/mvc-videos/video-361.aspx

cottsak
this is -very- easy to learn. save yourself headaches with access and move to mvc, .net and sql server
cottsak
I have the same issue with this as I do with the SQL Server Express idea (i.e. official channels, etc. when I just want a nice POC to show them it's doable.. trying to make things bearable at work..) in that I'll never get the company to host the site. I can't host it myself due to DoD restrictions.
AgentConundrum
host it on your workstation at work for POC
cottsak
d/l a free version of VMWare Workstation. there's heaps of options before you resort to Access.what im really saying is - dont use access!! please! i beg you. i've been an access dev for years. you need to move on. now is always the best time.
cottsak
He's not using Access -- he's using Jet as his data store.
David-W-Fenton
Distinctions between Access and Jet are often lost on most people who aren't exerts in the field (and even to some who are). Didn't you think the NZ() function (actually part of the Access object model) was part of Jet last week? And you mistook Jet Blue (ESE) for Jet Red (.mdb), didn't you?
onedaywhen
+1  A: 

You could start a background worker thread to do the refreshes in an infinite loop, and sleep at the end (or beginning) of each loop iteration.

mbeckish
A: 

orrite.. i'll crumble.

my best suggestion to poll the access data store would be to use a System.IO.FileSystemWatcher to monitor the folder where the mdb file lives. this way you can craft your code to poll at an interval but only when the Changed event fires. this should chew less cpu and disk access.

hope this helps. :D

cottsak
@cottsak: Thanks for the tip. One question though (just to add more fuel to this fire): Wouldn't this implementation mean that whenever the database is updated, all instances of the application would hammer the database at once? I think if all relevant teams ran this, there'd be around 30 instances.
AgentConundrum
(cont..) and I thought that Access (not necessarily jet, I suppose) is/used to be theoretically limited to 255 users, with a practical limit of around 30ish. I could be talking out of my ass though.
AgentConundrum
the practical limit u speak of is pretty accurate.yeh i think you're right - the clients will hammer the db when there is a change to the disk. but u'll get that with any polling. only with my suggestion it will happen less frequently, but at synchronized points in time. up to you hey.
cottsak