the_only.badman
the_only.badman

Reputation:

textboxes in Datarepeater dynamically 'databound'

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 dynamically 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 dynamically 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.

Upvotes: 0

Views: 1333

Answers (2)

John Nicholas
John Nicholas

Reputation: 4836

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.

Upvotes: 0

Stephen Wrighton
Stephen Wrighton

Reputation: 37819

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.

Upvotes: 1

Related Questions