views:

697

answers:

2

I need to know if it is possible to dynamically bind a textbox residing within a datarepeater to a 'dynamically' created BindingSource. I am using VB.net. The database I am using is a MySQL database.

I have to use the connection dynamicly due to the fact that the database my not permanently reside on the same server.

[edit]
ok, so it seams that i am a dolt when asking questions. The app that i am making is not web based. it is a simple (i hope) app that connects to a MySQL database, accesses a table so i can edit/view it. Current setup is using the Add DataSource wizard. I have successfully connected to the dbase dynamicly using the mysql connector dll but without the textboxes set at design time to a datasource, i am unsure on how to 'link' them via the datarepeater.

+1  A: 

Your connection string should be defined in your Web.Config, and if you move your database to a different server, it's just a matter of modifying the web.config entry. As long as you keep the connection string name the same, the BindingSource object will pick up the new value from the config.


edit

In truth, the same concept should apply here as it does in the web app answer listed above.

All of your data objects should be hard-coded, and it's just the connection string (which you'll have to either ask the user for, or push out as update when the DB moves) which will get modified.

For example, create a App.Config file in your project. Have one of your configuration values be the connection string. This config value will be where you go to get the connection string whenever you need it. Then your wizard will be there to allow users to easily modify the connection.

Stephen Wrighton
if it were web based, that would be awsome, but its not. Thanks
A: 

then look in app.config

the conenction string should be there.

If it is not then you should put it in here as you can change this file at any time and not have to recompile your app.

John Nicholas