|
-
Dec 6th, 2005, 11:59 AM
#1
Thread Starter
Frenzied Member
binding a ds to a text box control [* Resolved *]
Hello
I am having a lot of trouble with binding a ds to a text box control.
I have a query SELECT Name, Address, PostCode FROM Customer
This query fills the dataset. This works fine as l have tested this in my web service. The xml displays the name, address, and postcode.
But l get my error message when l try and bind this to the text box control. I have tried many things and l now that the syntax is right. Am l missing something.
//Error Message - Cannot create a child list for field Customer
txtName.DataBindings.Add("Text",ds,"Customer.Name");
txtAddress.DataBindings.Add("Text",ds,"Customer.Address");
txtPostcode.DataBindings.Add("Text",ds,"Customer.PostCode");
many thanks in advance,
Steve
Last edited by steve_rm; Dec 8th, 2005 at 12:43 AM.
steve
-
Dec 8th, 2005, 12:38 AM
#2
Thread Starter
Frenzied Member
Re: binding a ds to a text box control
The problem has been solved. This is what i did?
Code:
txtName.DataBindings.Add(new Binding("Text",ds.Tables[0],"Name");
Another question. Why do l need ds.Tables[0]. I know that the index point to the first table. And the dataset has only been filled with one table "customer".
I tried this but this method, but did not work.
Code:
txtName.DataBinding.Add(new Binding("Text",ds.Tables["Customer"],"Name");
Can you explain why ds.Tables["customer"] does not work?
Thanks in advance,
Steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|