I did this stuff more than 2 years ago and just wanted to share with "beginners" who are getting to know why webservice would be very useful when crossing the far distance and can be shared for many clients. This example shows you how to communicate with a DB Server on the Internet from a client application on your PC using SOAP protocol. Usually, Enterprise Information System (EIS) such as ERP, CRM, SCM are built for internal use purposes and installed on the LAN. We will use direct connection in that case and almost never have to care about the speed of the connection. But what happens if we implement an application with a DB Server on the Internet (maybe not EIS but a conference or online-meeting software for instance)? Can SOAP be one of the possible answers?
- First, we create a Web service that can connect to the Database Server (here I use SQL Server), and query to return information or interact with records
- Second, we create a Windows Forms client that can control the Web service and display the information or do whatever we want with the DB
Using the Code
You can find a full manual inside the ZIP file, together with a tutorial video. By the way, since this code was written long time ago, it's still in .NET 2003 and I'm not sure if it can run on .NET 2005 (after conversion). And I'm sorry if someone may ask for tungDbDriver.dll inside the ZIP file. I lost that assembly code and according to me, that DLL is very simple to write. And since the main purpose of this article is to give a tutorial on the advantage of webservice, please forgive me about it. Thanks.
Points of Interest
I consider the most interesting point to be the way we can establish connection with a "remote" database server on the Internet. Imagine that Yahoo or MSN Chat applications always require users to log-in first. When users key in the username and password, it sends a message to the server and checks to make sure that the user is in the database with the right password that has been provided by the user. I don't think they use SOAP protocol but Client/Server with messages sent between them are the way those applications communicate, similar to SOAP. There is "no direct connection" between the client application and the database server.
Other Good Tutorials