A
Aaron
Hi,
The SqlDataAdapter.FillSchema method will automatically setup things
like the primary keys, auto increment, etc based on the settings on the
SQL Server. However, if you create a datatable using the SQL statement
that joins together data from multiple data tables, then FillSchema
does not work (as much? at all??). For example, if I use the following
query:
SELECT Material.*, Color.Color AS Color
FROM Material INNER JOIN
Color ON Color.ColorID = Material.fkColorID
FillSchema does not obtain MaterialID, the primary key of the Material
table, as the primary key, even though its uniqueness is not affected
at all by the JOIN with Color.
It is, of course, possible to manually configure primary keys.
However, this is not as desirable as the automated FillSchema approach.
Is this just the way things are, or is there some trick that I am
missing?
Thanks,
Aaron
The SqlDataAdapter.FillSchema method will automatically setup things
like the primary keys, auto increment, etc based on the settings on the
SQL Server. However, if you create a datatable using the SQL statement
that joins together data from multiple data tables, then FillSchema
does not work (as much? at all??). For example, if I use the following
query:
SELECT Material.*, Color.Color AS Color
FROM Material INNER JOIN
Color ON Color.ColorID = Material.fkColorID
FillSchema does not obtain MaterialID, the primary key of the Material
table, as the primary key, even though its uniqueness is not affected
at all by the JOIN with Color.
It is, of course, possible to manually configure primary keys.
However, this is not as desirable as the automated FillSchema approach.
Is this just the way things are, or is there some trick that I am
missing?
Thanks,
Aaron