New columns in database -> added to the DataSet automatically.

  • Thread starter Thread starter Trygve Lorentzen
  • Start date Start date
T

Trygve Lorentzen

Hi,

I do a "select * from tablename" in my dataadapter. In most cases this is
fine because all those columns are also defined in the strongly typed
dataset I'm working with. However, if I add a few new columns or want to use
the dataadapter to fill a different dataset where not all columns are
defined, those columns are still "automatically" created by ado.net at
runtime. Is this by design or can I somehow turn off this behaviour? It
would be great if only the columns that are defined in the dataset
design-time would still be present run-time, but I can't seem to find a way
to do this.

Perhaps there is no other solution than to change the select statement in
the dataadapter to only include the columns that I want to appear in the
dataset at runtime.

Environment: .net 1.1 (same behaviour in 2.0), MySQL database, CoreLab.MySQL
ado.net connector. Visual studio 2003/2005.

Best regards,
Trygve Lorentzen
 
Hi Trygve,

No you have to set that in your select statement, the dataset is created
from the resultset that it gets from the Database server whatever brand that
is.

A strongly typed dataset is nothing more than an inherited non strongly one.
However what is the problem. As in all inheriting, it does not use the
properties strongly typed which are not used. (You can get them still from
the base in a non inherited way).

Cor
 
Back
Top