Form2 DataAdapter/DataSet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I've done a drag and drop of a sqlDataAdapter and generated a dataset on a
second WinForm (Form2) I'm opening as a dialog box. I can bind to it and
retrieve results but I get an error when I try to use any
BindingContext.Count/Position methods on the dataset. Any help greatly
appreciated.

Error: 'Cannot create a child list for field myTable.'

Code Snippet Follows:=======================================
try
{
int iCnt;
iCnt = this.BindingContext[this.dsDataSet1, "myTable"].Count;
}
catch(Exception exp)
{
MessageBox.Show(exp.Message.ToString());
}
 
What is the content of your DataSet? Is "myTable" the name of a table in the
DataSet?

Are you sure that's the table name and not the name of the DataTable
variable? In other words, is dsDataSet1.Tables[0].TableName = "myTable"?

Assuming of course that your dataset only has one table.

Pete
 
Hi, and thanks for responding. There is only one table in the dsDataSet1
DataSet and that table is 'myTable'.

Pete Davis said:
What is the content of your DataSet? Is "myTable" the name of a table in the
DataSet?

Are you sure that's the table name and not the name of the DataTable
variable? In other words, is dsDataSet1.Tables[0].TableName = "myTable"?

Assuming of course that your dataset only has one table.

Pete

Rich said:
Hi,

I've done a drag and drop of a sqlDataAdapter and generated a dataset on a
second WinForm (Form2) I'm opening as a dialog box. I can bind to it and
retrieve results but I get an error when I try to use any
BindingContext.Count/Position methods on the dataset. Any help greatly
appreciated.

Error: 'Cannot create a child list for field myTable.'

Code Snippet Follows:=======================================
try
{
int iCnt;
iCnt = this.BindingContext[this.dsDataSet1, "myTable"].Count;
}
catch(Exception exp)
{
MessageBox.Show(exp.Message.ToString());
}
 
Back
Top