Adding an existing datatable to an existing dataset

S

STom

I am trying to add an existing datatable to a dataset that I created via:

Dim ds as new Dataset

Currently I have no connection to a database.

Is there a way to put this table I have into the datasets Table(0) position?

Thanks.

STom
 
W

William \(Bill\) Vaughn

Try
Ds.Tables.Add(ds)

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
S

STom

Well, once again my level of stupidity amazes me.

This all started while trying to figure out how to bind a Winform text box to a datarow.

I have a datarow array that I retrieved from the datasets datatable like this:
m_dr = m_ds.Tables(0).Select("Name = 'Jerry'")

I suppose I could also do a find on the table or something but anyway....

I want to bind my txtName box to this datarow something like this:

Me.txtName.DataBindings.Add("Text", m_dr(0), "Name")

Basically, from this I get an error that says :
Cannot bind to property or column Name on DataSource.

What property can be used on a data row array to do binding?

Thanks.

STom
 
W

William \(Bill\) Vaughn

Bind to the DataTable, not the row.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Well, once again my level of stupidity amazes me.

This all started while trying to figure out how to bind a Winform text box to a datarow.

I have a datarow array that I retrieved from the datasets datatable like this:
m_dr = m_ds.Tables(0).Select("Name = 'Jerry'")

I suppose I could also do a find on the table or something but anyway....

I want to bind my txtName box to this datarow something like this:

Me.txtName.DataBindings.Add("Text", m_dr(0), "Name")

Basically, from this I get an error that says :
Cannot bind to property or column Name on DataSource.

What property can be used on a data row array to do binding?

Thanks.

STom
 
S

STom

What I am trying to do is have data from a specific row appear in the text
boxes. If I bind to the datatable, I end up just seeing what is in the first
row of the table.

Do I need to first bind to the data table and then move to the row I want?

Thanks for your help.

STom
Bind to the DataTable, not the row.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Well, once again my level of stupidity amazes me.

This all started while trying to figure out how to bind a Winform text box
to a datarow.

I have a datarow array that I retrieved from the datasets datatable like
this:
m_dr = m_ds.Tables(0).Select("Name = 'Jerry'")

I suppose I could also do a find on the table or something but anyway....

I want to bind my txtName box to this datarow something like this:

Me.txtName.DataBindings.Add("Text", m_dr(0), "Name")

Basically, from this I get an error that says :
Cannot bind to property or column Name on DataSource.

What property can be used on a data row array to do binding?

Thanks.

STom
 
W

William \(Bill\) Vaughn

Right. Set the Position property to point to the correct row.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

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

Top