469,568 Members | 1,519 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

DataSet Problem

Can anyone tell me why this doesn't work

ds.Tables[0].Rows[0].ItemArray[TITLE] = m_sTitle;

Nov 16 '05 #1
4 3261
Try this,

ds.Tables[0].Rows[0]["TITLE"] = m_sTitle;

I replaced your TITLE with "TITLE" because I assumed that was the actual
name of the column.

HTH
--
Lateralus [MCAD]

"NewGuy" <a@a.com> wrote in message
news:u8**************@TK2MSFTNGP10.phx.gbl...
Can anyone tell me why this doesn't work

ds.Tables[0].Rows[0].ItemArray[TITLE] = m_sTitle;

Nov 16 '05 #2
Hi NewGuy,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you're trying to modify a cell's value
using ds.Tables[0].Rows[0].ItemArray[TITLE] = m_sTitle. However, this
doesn't work. If there is any misunderstanding, please feel free to let me
know.

This doesn't work, because the ItemArray property returns another instance
of values of that row. So when you assign value to that array, actually
you're not modifying the DataRow object but another instance of object
array. So the changes cannot be seen from the DataSet. You can try to
following instead:

ds.Tables[0].Rows[0][TITLE] = m_sTitle;

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #3
You could either set the values as suggested, or set the whole Array
together. Check out this page in MSDN
http://msdn.microsoft.com/library/de...arraytopic.asp

"NewGuy" wrote:
Can anyone tell me why this doesn't work

ds.Tables[0].Rows[0].ItemArray[TITLE] = m_sTitle;

Nov 16 '05 #4
Thanks Kevin,

That did the trick. Thanks to everyone else for sugestions as well.

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:6V**************@cpmsftngxa10.phx.gbl...
Hi NewGuy,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you're trying to modify a cell's value
using ds.Tables[0].Rows[0].ItemArray[TITLE] = m_sTitle. However, this
doesn't work. If there is any misunderstanding, please feel free to let me
know.

This doesn't work, because the ItemArray property returns another instance
of values of that row. So when you assign value to that array, actually
you're not modifying the DataRow object but another instance of object
array. So the changes cannot be seen from the DataSet. You can try to
following instead:

ds.Tables[0].Rows[0][TITLE] = m_sTitle;

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Joerg M. Colberg | last post: by
2 posts views Thread by Dennis | last post: by
22 posts views Thread by Arne | last post: by
2 posts views Thread by Carl Summers | last post: by
8 posts views Thread by Harry Strybos | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.