Reputation: 17157
I am learning Visual Studio 2010. I want to make a webpage that shows the contents of a table in my database, and updates asynchronously as the data in the table updates. I am guessing I want to make either a "WCF Service" or a "Web Form". Am I correct?
I'm starting this application from scratch so there's no existing code I need to mesh with. Just want to get the basic functionality working. The main thing I want is to have that asynchronous update.
Upvotes: 0
Views: 95
Reputation: 1630
What you should be looking at are GridView and SqlDataSource from Web Forms.
GridView is a control that displays a table-like element.
SqlDataSource is where GridView get the data from and sending the data to, which has to connect to the database using a connection string.
In order to have all the CRUD functionality, you need to have SelectCommand, InsertCommand, UpdataComand and DeleteCommand all inside an SqlDataSource.
Upvotes: 1
Reputation: 46047
As far as displaying the data on a web page, you would definitely want to use a web form.
Updating the web page in real-time will be difficult, and it will require a lot of fine tuning so it doesn't suck up server resources. In short, you would need to poll the database every n seconds using JavaScript and AJAX, with a server-side callback to bind the changes to the grid.
If I were you, I would avoid real-time updating and find a comfortable in-between.
Upvotes: 0
Reputation: 47377
You do not want a WCF Service. A Web Form or an MVC Application is the way to go.
I prefer MVC Application since it's just nice to use, but a Web Form will achieve what you're looking for equally well.
In order to get the Asynchronous bit working, you either use the Ajax Toolkit, or better yet, wire up some jQuery/Mootools, or something similar.
Here's another (similar) SO question and the answers point to ways to achieve the async bit.
asp.net webforms ajax update gridview
Upvotes: 2
Reputation: 1038770
The main thing I want is to have that asynchronous update.
You may checkout SignalR for PUSHing updates to the client. And if you want to use a more standard PULL model, you could use the setInterval javascript function and send periodical AJAX requests to the server to check for updates. In both cases you need an ASP.NET frontal application. As far as the actual data fetching is concerned this could be done either directly by the ASP.NET application or if you want to build a reusable service you could abstract it into a WCF service that your ASP.NET application will consume.
Upvotes: 1