Setting new Connectionstring to dataadapter at RT

sethindeed

Well-known member
Joined
Dec 31, 1969
Messages
118
Location
Montreal Canada
Following one of my previous question, is it possible to modify the connectionstring of a dataadapter at runtime.
What I want to do is to connect to a different database using the same dataadapter

Many thanx !
 
Dataadapters dont have connection strings but you can modify the connection string of a connection object at runtime. You can point the dataadapter whereever you want as far as I know, though for whatever reason Ive never had a use-case for connecting one to two different data sources.
 
Thanx
BTW, is it just me or with the dataadapter and the datareader, I can do prettu much all the operations I need.
I mean, all the books I read pointed to the dataset object but I finally ended without using it.
Dataset is useful only when you want to store multiple tables or what ?
 
A DataSet can include multiple tables, as you mentioned, along with relations and key constraints, which are very useful if your database is correctly normalized. DataSets are also incredibly easy to pass between your applications different tiers, from function to function or across a serialized stream. DataReaders are limited to groupings of rows, either from a single table or two or more tables being joined together, and cant be passed around as a DataSet can be. Both the DataSet and the DataReader have their purposes, however the DataSet is used quite a bit more throughout the majority of .NET examples and documentation, primarily since it binds so easily with the DataGrid control.

My advice? Use the one that does what you need it to.
 
Back
Top