G
Guest
I'm filling DataTables from a SQL2005 database using either simple "select
.... from ..." or stored procedures as the data source. Before I get the data
itself I call FillSchema because there are a couple of things I want to do
depending on some column properties. This all works just fine.
Now, with one particular stored procedure, Fill fails due to a violation of
non-null or unique constraints. I've checked all the columns in the data
table after FillSchema and indeed, one of them is declared as unique - but
the data returned by the query isn't. So the violation error is actually
correct.
But I don't want this column to be considered unique, it contains a foreign
key, and I can't understand why FillSchema thinks it is. I have another
almost identical stored proc, which also returns the column in question - and
which does not cause the error. Where's the difference? If there is one, I
haven't found it yet!
I don't want to manually correct the unique property for this column in my
FillSchema code; that would be too specific and doesn't make sense. There
must be some reason for it.
If necessary, I'll post code, but the sps are rather involved. Perhaps
someone has an idea just from the problem description. Any tips on how
FillSchema decides if a column is unique or not would be appreciated as well.
Thanks
Tom
.... from ..." or stored procedures as the data source. Before I get the data
itself I call FillSchema because there are a couple of things I want to do
depending on some column properties. This all works just fine.
Now, with one particular stored procedure, Fill fails due to a violation of
non-null or unique constraints. I've checked all the columns in the data
table after FillSchema and indeed, one of them is declared as unique - but
the data returned by the query isn't. So the violation error is actually
correct.
But I don't want this column to be considered unique, it contains a foreign
key, and I can't understand why FillSchema thinks it is. I have another
almost identical stored proc, which also returns the column in question - and
which does not cause the error. Where's the difference? If there is one, I
haven't found it yet!
I don't want to manually correct the unique property for this column in my
FillSchema code; that would be too specific and doesn't make sense. There
must be some reason for it.
If necessary, I'll post code, but the sps are rather involved. Perhaps
someone has an idea just from the problem description. Any tips on how
FillSchema decides if a column is unique or not would be appreciated as well.
Thanks
Tom