views:

35

answers:

2

We have a winform application that needs to display some results calculated on the DB that exists on a server.

In the current solution, we have a VPN connection that connects us to the server database, we query the data from the server DB using a normal SQLConnection . We get the data, then we do the calculation at the client side For bandwidth utilization, we want the calculation to be done at the server side, and the end result is just sent to the user.

so the client just executes

double[] getResults(tableName t, ColumnName c, Key k)
{ //execute at the server
return results;
}

What is the simplest way to acheive that? Please give me details

thank you

+1  A: 

Well, the least "moving parts" would be to do the processing in TSQL at the db server, but that may not be a good idea (depending on the scenario).

Assuming you want to do the processing in C#, you should probably host a WCF or asmx (WSE) service in a web-server such as IIS - and add a service reference between your client app and the service. The service does the call to the database and the processing, and returns the double[].

However, this is quite a bit of infrastructure...

You can also host WCF in a windows service (or even a console exe), which might make life easier (no IIS).

Marc Gravell
I never worked with Web services before. I reviewed this link. it assumes that we're gonna exeucte the service on the local machine. What if I just know the IP address of the server to which I am connected by VPN, shall I just replace 'localhost' with the of the server? what about the port address?
Mustafa A. Jabbar
which link? yes, you'll need some way of identifying the server - but I can't comment on the article (since you haven't cited it).
Marc Gravell
http://msdn.microsoft.com/en-us/library/ms733069.aspx
Mustafa A. Jabbar
here is the link
Mustafa A. Jabbar
Yes, you can just specify the endpoint address/port in the config file.
Marc Gravell
A: 

It depends on what kind of calculations this is regarding. Either you can solve it with T-SQL or you can use C# in CLR-FUNCTION if you are using SQL2005 and above.

Joakim Backman