C
cpnet
I'm having a frustrating problem trying to set up a master-detail
relationship between 2 datagrids. I've used DataSets extensively before,
but only in code and basically only in a disconnected state. Now as I try
to set up this simple master-detail thing, I'm having problems.
I have about 6 tables in a SQL Server 2000 database. All tables have single
field primary keys, and I've created appropriate relationships betwen the
tables in SQL Server.
In VS 2003, I've created a SQLDataAdapter for each table, that interacts
with the table via stored procedures created by the SQLDataAdapter wizard.
I then used the "Generate Dataset..." functionality of one of the data
adapters to autogenerate dataset that included all 6 tables (i.e. it was
based on all 6 data adapters). So far so good. In the DataSet schema
editor, I created relationships between the datatables to mimic the
relationships in SQL Server. This seems to go ok, and when I "Preview
DataSet" from the schema editor, all seems ok - including the relationships.
I also have a WinForm that has 2 DataGrids on it. Both DataGrids have the
DataSet I created as their DataSource. When I try to list the DataTables in
the DataGrid.DataMember property so I can set up the DataGrids for the
master-detail, I the the error, "Cannot create a child list for field
MyTable", where 'MyTable' is one of my DataTables in the DataSet. If I
remove all of the relations from the DataSet, and save the .xsd schema a few
times (moving the datatables on the designer between saves so there's
something to save), the error will go away - but then I have no
relationships. So, I re-create the relationships in the DataSet schema
editor, and I start getting the error again. Sometimes I don't get the
error until I have more than one relationship, and sometimes by moving the
datatables on the schema designer and re-saving the dataset schema a few
times, I don't get the error - even when the dataset has 2 relationships.
It seems some code is getting corrupted somewhere. I've tried restarting
VS, and I've rebooted my machine. I've also deleted the DataSet and created
it again from scratch. The same thing happens.
When running my project, I can successfully fill my DataSet from the
DataAdapters, but I get the same error when I try to set the DataMember
property of one of the DataGrids in code.
What's going on?
relationship between 2 datagrids. I've used DataSets extensively before,
but only in code and basically only in a disconnected state. Now as I try
to set up this simple master-detail thing, I'm having problems.
I have about 6 tables in a SQL Server 2000 database. All tables have single
field primary keys, and I've created appropriate relationships betwen the
tables in SQL Server.
In VS 2003, I've created a SQLDataAdapter for each table, that interacts
with the table via stored procedures created by the SQLDataAdapter wizard.
I then used the "Generate Dataset..." functionality of one of the data
adapters to autogenerate dataset that included all 6 tables (i.e. it was
based on all 6 data adapters). So far so good. In the DataSet schema
editor, I created relationships between the datatables to mimic the
relationships in SQL Server. This seems to go ok, and when I "Preview
DataSet" from the schema editor, all seems ok - including the relationships.
I also have a WinForm that has 2 DataGrids on it. Both DataGrids have the
DataSet I created as their DataSource. When I try to list the DataTables in
the DataGrid.DataMember property so I can set up the DataGrids for the
master-detail, I the the error, "Cannot create a child list for field
MyTable", where 'MyTable' is one of my DataTables in the DataSet. If I
remove all of the relations from the DataSet, and save the .xsd schema a few
times (moving the datatables on the designer between saves so there's
something to save), the error will go away - but then I have no
relationships. So, I re-create the relationships in the DataSet schema
editor, and I start getting the error again. Sometimes I don't get the
error until I have more than one relationship, and sometimes by moving the
datatables on the schema designer and re-saving the dataset schema a few
times, I don't get the error - even when the dataset has 2 relationships.
It seems some code is getting corrupted somewhere. I've tried restarting
VS, and I've rebooted my machine. I've also deleted the DataSet and created
it again from scratch. The same thing happens.
When running my project, I can successfully fill my DataSet from the
DataAdapters, but I get the same error when I try to set the DataMember
property of one of the DataGrids in code.
What's going on?