开发者

Winforms retrieving data from database

I'm developing a windows form application. Could any one please a开发者_StackOverflow中文版dvise what are the different ways I can connect to database and retrieve the data.

I know one way is through Webservice? Is there any other way? I am guessing no?

Any help much appreciated.


Your question is too general but let me try to answer it. In case the Data base server is across WAN you will need to expose some web service on server to expose the data from data base otherwise in case the database is in a LAN environment or on local machine you can use various data access components on .NET like ADO.NET, Linq to SQL, EF etc to access the database.


If Database is on different server than local application you can use either Webservices to get data or open port and allow TCP/IP connections in SqlServer to access from anywhere ( or specific location by blocking IP addresses in firewall ). Second one is not secure.


There are several ways. cuz you ask General question.

but Almost, we can group ways into 2 group:

  1. Local
  2. Remote(service)

For first group we have 2 famous way in .net: ADO and Linq
For second, You can think about Wcf, Web Services.(otherwise in order use this way, you need to local way's in your service to access to database).

This is related to your program-architecture.


You can connect to the database in different designs. Like, different access layers, using Data access layer. You can use web service but not required much in this case.

You can approach MVC model too.

At the final alternate, simply use inside the form itself.


Best thing to start is to get an overview on http://msdn.microsoft.com/en-us/data/default

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜