Hi,
I perform a set of operations on a dataset table:
MyDataSet sharedDS = new MyDataSet();
MyDataSet referenceDS = new MyDataSet();
sharedDS.Table1.Reset();
sharedDS.Merge(referenceDS);
I get a System.ArgumentException: Column_X does not exist in Table1 if I try to access the column this way:
MyDataSet.Table1.FindByKey().Column_X
However, this way everything's fine:
MyDataSet.Table1.FindByKey()["Column_X"]
Can anyone explain what's the issue here?
Reference (originally meant for another problem): http://stackoverflow.com/questions/764004/reset-primary-key
From stackoverflow
-
I think this line :
sharedDS.Table1.Reset();is causing you trouble.
I think the .reset is clearing the schema. Use .Clear() istead!
Farooq : you're right. it is being used to clear the schema. in this case i clear the schema and then copy it from an instance of the same dataset again. now the schema is set but i can only access the column in one particular way. i suspect this could be linked to something similar to: http://kbalertz.com/815545/unhandled-exception-occurs-after-rename-columns-DataSet-object.aspx
0 comments:
Post a Comment