views:

38

answers:

1

Ok, so I've got this Visual Studio 2008 Project I was working with about a year ago perhaps. And this project had a datagrid that was linked to an external database running on a server off the internet. Now, this databinding was all done using Visual Studio 2008's built in features. But how can I now change the binding to a different server, without destroying the project? I've noticed that a lot of the code that Visual Studio creates makes a mess. So manually trying to change the datasource has allways f*cked up the whole project for me.

I'm not all that good with this stuff, that's why I used the built in features of Visual Studio. But I noticed that several things appear, like a binding source, and a dataset. Is it possible to do this? Perhaps even better, making these settings be controlled after the program has been compiled. The way it is now, it's all hard coded after compiling, and that kinda sucks. I remember trying to do this about a year ago, trying to bind these settings to variables stored in settings. But I never got that to work. Just throwing around ideas here :)

Any help, pointers or whatever is highly appreciated! :)

+1  A: 

In the Solution Explorer window, "show all files". If you expand out the files under your form, you can find the Form1.Designer.vb file. This is the code that VS generated to support those "built in" features you used.

Look at the code in this file and search for the name of your old server. Hack away.

Bill
Ok, I'll give it a try. I've previously tried to do it this way but the whole project have just crashed each time I've tried. What do I really need to change? Do I have to alter the dataset at all? Or just the source? And instead of setting a static server value, can I bind it to my.settings instead?
Kenny Bones
If your new server is really set up exactly the same as the old one, just changing the server name should do it (with a recompile). And yes, you should bind the server value to your settings, but do that in your code file, not in the designer file (so others can find it). If all of that fails, have your IT folks create a DNS alias that points the old name to the new server.
Bill
Yeah, I used IP address actually, not DNS name. I'll gonna give it a try, as soon as the new server is up and running correctly.
Kenny Bones