469,651 Members | 1,676 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,651 developers. It's quick & easy.

Form2 DataAdapter/DataSet

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());
}
Nov 17 '05 #1
2 1129
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" <Ri**@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
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());
}

Nov 17 '05 #2
Hi, and thanks for responding. There is only one table in the dsDataSet1
DataSet and that table is 'myTable'.

"Pete Davis" wrote:
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" <Ri**@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
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());
}


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by JJ | last post: by
6 posts views Thread by Geoff Pennington | last post: by
13 posts views Thread by Doug Bell | last post: by
8 posts views Thread by Zorpiedoman | last post: by
reply views Thread by davefromalbury | last post: by
2 posts views Thread by susan.f.barrett | last post: by
3 posts views Thread by Fred Chateau | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.