Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 help bind ds to text box

Author  Topic 

Hommer
Aged Yak Warrior

808 Posts

Posted - 2006-05-25 : 14:54:24
Somebody pease help me here.

I want to bind my dataset data to UI controls, but according to MSDN I need to specify a navigation path in the form : TableName.ColumnName.

textBox1.DataBindings.Add _
(New Binding("Text", ds, "customers.custName"))

My ds was from a stored proc by using a wrapper class from MS data access application block. I don't have a TableName per se.

I can bind to it in the following way for a datagrid.

DataGrid1.DataSource = ds.Tables(0).DefaultView

I am sure there are other ways to bind, but just don't know how. I sure miss the old days when you can just txtMytext = rs.fileds("myCol").

Btw, I am using VS2003 (.net 1.1) and this is for a window app.

Thanks!

Hommer
Aged Yak Warrior

808 Posts

Posted - 2006-05-25 : 17:34:21
Am I out of luck? I could not think of any thing that is more simple than this. You got the data into a dataset, now you want to load that data in to several textboxs.

I have spend couple hours on this, totally frustrated.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-05-25 : 18:36:13
There are only a few people here who answer .NET programming questions. You might have better luck if you post your question on a site specific to .NET programming, such as [url]http://www.asp.net[/url].

Tara Kizer
aka tduggan
Go to Top of Page

dfiala
Posting Yak Master

116 Posts

Posted - 2006-05-25 : 20:40:26
This is a ASP.NET forum, but hey, its's all good.

You can name your tables after they are created

ds.Tables(0).TableName ="ATable"

Then you should be able to do the magic bindings.

You also don't have to bind and can directly set the property...

textBox1.Text = ds.Tables(0).Columns("SomeColumn").ToString()

You of course can still do it the old fashioned way with a data reader too...

textBox1.Text = dr.GetValue("SomeColumn").ToString()

or something like that.

Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP
Go to Top of Page

Hommer
Aged Yak Warrior

808 Posts

Posted - 2006-05-26 : 09:26:01
Great! Thank you all!
Go to Top of Page
   

- Advertisement -