Can't Create Child List

P

Phaneendra

Hi,
I am trying to develop a Windows application in C#. In
one of the forms i have a few text controls (4 to be
exact). I need to display the values of the columns in a
table (tblCustomer)in the text controls.I did not bind my
controls at design time. In the form load event i created
a sqlDataAdapter and used that to fill my dataset(i named
it DS). I am able to display the values in the first row
of the table correctly. But the problem comes while i am
trying to navigate to the next record.

The code looks like this :
BindingMangerBase LMgr;
form_load
{

sqlDataAdapter da = new sqlDataAdapter("Select * from
tblCustomer", con);
DataSet DS = new DataSet();
da.fill(DS);
Lmgr = this.BindingContext[DS, "tblCustomers"];
txtName.Add("Text", DS.Tables[0], "Name");
}

btn_NextClick
{
LMgr.Position += 1;
}

I defined LMgr to use for navigation. But the last line is
giving an error " Cannot create Child List for
tblCustomer". I tried various ways of defining the
BindingContext, but the problem remains the same. MSDN
documentation states the above exception under the
Exception heading. But does not specify why it happens or
what needs to be done to overcome this. Please advise.
Thank you for your time.

regards,
Phaneendra.
 
S

Serg Kuryata [MS]

Hello Phaneendra,

I attached a simple sample that shows how to implement the functionality
you need.

Hope this helps.
Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "Phaneendra" <[email protected]>
| Sender: "Phaneendra" <[email protected]>
| Subject: Can't Create Child List
| Date: Fri, 10 Oct 2003 11:00:12 -0700
| Lines: 41
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcOPWFnaYqfsK9QxR5K6QfUb4W5BzA==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:35705
| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi,
| I am trying to develop a Windows application in C#. In
| one of the forms i have a few text controls (4 to be
| exact). I need to display the values of the columns in a
| table (tblCustomer)in the text controls.I did not bind my
| controls at design time. In the form load event i created
| a sqlDataAdapter and used that to fill my dataset(i named
| it DS). I am able to display the values in the first row
| of the table correctly. But the problem comes while i am
| trying to navigate to the next record.
|
| The code looks like this :
| BindingMangerBase LMgr;
| form_load
| {
|
| sqlDataAdapter da = new sqlDataAdapter("Select * from
| tblCustomer", con);
| DataSet DS = new DataSet();
| da.fill(DS);
| Lmgr = this.BindingContext[DS, "tblCustomers"];
| txtName.Add("Text", DS.Tables[0], "Name");
| }
|
| btn_NextClick
| {
| LMgr.Position += 1;
| }
|
| I defined LMgr to use for navigation. But the last line is
| giving an error " Cannot create Child List for
| tblCustomer". I tried various ways of defining the
| BindingContext, but the problem remains the same. MSDN
| documentation states the above exception under the
| Exception heading. But does not specify why it happens or
| what needs to be done to overcome this. Please advise.
| Thank you for your time.
|
| regards,
| Phaneendra.
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top