Hi

How can I change some values in the DataRow? I make a query to get some
records out of database and then I want to change some, but it doesn't seem
to work. With the following code, nothing gets set:

foreach(DataRow myRow in Table1.Rows)
myRow.ItemArray.SetValue("overwritten value", 0)

myRow contains 3 columns and I would like to change the first one - index 0.

Please help,
Alen

Re: Changing values in DataRow by Dmitriy

Dmitriy
Tue Sep 09 07:05:18 CDT 2003

Hi Alen,

> myRow.ItemArray.SetValue("overwritten value", 0)

This should work:

myRow.BeginEdit()
myRow.Item(0) = "overwritten value"
myRow.EndEdit()

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Alen Oblak" <alen@oblacek.com> wrote in message
news:wIi7b.2324$2B6.548014@news.siol.net...
> Hi
>
> How can I change some values in the DataRow? I make a query to get some
> records out of database and then I want to change some, but it doesn't
seem
> to work. With the following code, nothing gets set:
>
> foreach(DataRow myRow in Table1.Rows)
> myRow.ItemArray.SetValue("overwritten value", 0)
>
> myRow contains 3 columns and I would like to change the first one - index
0.
>
> Please help,
> Alen
>
>


Re: Changing values in DataRow by Alen

Alen
Tue Sep 09 08:05:52 CDT 2003

myRow doesn't contain a definition for Item, so it doesn't work.

"Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com> wrote
in message news:#nNvkqsdDHA.2340@TK2MSFTNGP09.phx.gbl...
> Hi Alen,
>
> > myRow.ItemArray.SetValue("overwritten value", 0)
>
> This should work:
>
> myRow.BeginEdit()
> myRow.Item(0) = "overwritten value"
> myRow.EndEdit()
>
> --
> Dmitriy Lapshin [C# / .NET MVP]
> X-Unity Test Studio
> http://x-unity.miik.com.ua/teststudio.aspx
> Bring the power of unit testing to VS .NET IDE
>
> "Alen Oblak" <alen@oblacek.com> wrote in message
> news:wIi7b.2324$2B6.548014@news.siol.net...
> > Hi
> >
> > How can I change some values in the DataRow? I make a query to get some
> > records out of database and then I want to change some, but it doesn't
> seem
> > to work. With the following code, nothing gets set:
> >
> > foreach(DataRow myRow in Table1.Rows)
> > myRow.ItemArray.SetValue("overwritten value", 0)
> >
> > myRow contains 3 columns and I would like to change the first one -
index
> 0.
> >
> > Please help,
> > Alen
> >
> >
>



Re: Changing values in DataRow by Dmitriy

Dmitriy
Tue Sep 09 09:02:18 CDT 2003

Correction:

You should write

myRow(0) = "overwritten value"

since Item is the default property.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Alen Oblak" <alen@oblacek.com> wrote in message
news:Mek7b.2332$2B6.549375@news.siol.net...
> myRow doesn't contain a definition for Item, so it doesn't work.
>
> "Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com> wrote
> in message news:#nNvkqsdDHA.2340@TK2MSFTNGP09.phx.gbl...
> > Hi Alen,
> >
> > > myRow.ItemArray.SetValue("overwritten value", 0)
> >
> > This should work:
> >
> > myRow.BeginEdit()
> > myRow.Item(0) = "overwritten value"
> > myRow.EndEdit()
> >
> > --
> > Dmitriy Lapshin [C# / .NET MVP]
> > X-Unity Test Studio
> > http://x-unity.miik.com.ua/teststudio.aspx
> > Bring the power of unit testing to VS .NET IDE
> >
> > "Alen Oblak" <alen@oblacek.com> wrote in message
> > news:wIi7b.2324$2B6.548014@news.siol.net...
> > > Hi
> > >
> > > How can I change some values in the DataRow? I make a query to get
some
> > > records out of database and then I want to change some, but it doesn't
> > seem
> > > to work. With the following code, nothing gets set:
> > >
> > > foreach(DataRow myRow in Table1.Rows)
> > > myRow.ItemArray.SetValue("overwritten value", 0)
> > >
> > > myRow contains 3 columns and I would like to change the first one -
> index
> > 0.
> > >
> > > Please help,
> > > Alen
> > >
> > >
> >
>
>


Re: Changing values in DataRow by Alen

Alen
Tue Sep 09 09:15:41 CDT 2003

Thanks! It works!

"Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com> wrote
in message news:uclK8rtdDHA.904@TK2MSFTNGP11.phx.gbl...
> Correction:
>
> You should write
>
> myRow(0) = "overwritten value"
>
> since Item is the default property.
>
> --
> Dmitriy Lapshin [C# / .NET MVP]
> X-Unity Test Studio
> http://x-unity.miik.com.ua/teststudio.aspx
> Bring the power of unit testing to VS .NET IDE
>
> "Alen Oblak" <alen@oblacek.com> wrote in message
> news:Mek7b.2332$2B6.549375@news.siol.net...
> > myRow doesn't contain a definition for Item, so it doesn't work.
> >
> > "Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com>
wrote
> > in message news:#nNvkqsdDHA.2340@TK2MSFTNGP09.phx.gbl...
> > > Hi Alen,
> > >
> > > > myRow.ItemArray.SetValue("overwritten value", 0)
> > >
> > > This should work:
> > >
> > > myRow.BeginEdit()
> > > myRow.Item(0) = "overwritten value"
> > > myRow.EndEdit()
> > >
> > > --
> > > Dmitriy Lapshin [C# / .NET MVP]
> > > X-Unity Test Studio
> > > http://x-unity.miik.com.ua/teststudio.aspx
> > > Bring the power of unit testing to VS .NET IDE
> > >
> > > "Alen Oblak" <alen@oblacek.com> wrote in message
> > > news:wIi7b.2324$2B6.548014@news.siol.net...
> > > > Hi
> > > >
> > > > How can I change some values in the DataRow? I make a query to get
> some
> > > > records out of database and then I want to change some, but it
doesn't
> > > seem
> > > > to work. With the following code, nothing gets set:
> > > >
> > > > foreach(DataRow myRow in Table1.Rows)
> > > > myRow.ItemArray.SetValue("overwritten value", 0)
> > > >
> > > > myRow contains 3 columns and I would like to change the first one -
> > index
> > > 0.
> > > >
> > > > Please help,
> > > > Alen
> > > >
> > > >
> > >
> >
> >
>