Re: update query in DataTable??

From: ZeroVisio (ZeroVisio_at_discussions.microsoft.com)
Date: 03/24/05


Date: Thu, 24 Mar 2005 14:03:02 -0800

yaah i just want to commit changes to datatable in memory. righnow i dont
intend to write this table to any database (but maybe in future if it is
needed). here is exactly what im trying to do.

i have seven columns and some rows in my datatable: here is my snapshot of
datatable

id, type,text, start, end, st_flg, end_flg
3, Strategy , pmts, 1, 2, N, N
5, Strategy , print, 1, 4, N, N
7, Strategy, Mail, 1, 6, N, N

now after checking a condiition i want to change N to Y in st_flg and/or
end_flg.

so I retrieve rows that match my criteria and want to update the st_flg
and/or end_flg. However all this in memory. no final commitment to database.

i thought of using datarow.itemarray.setvalue but then dont know how this
will reflect back to my table.

hope you can help!

"Nicholas Paldino [.NET/C# MVP]" wrote:

> ZeroVisio,
>
> But where do you want to make the changes to? Do you just want to
> commit them to the DataTable in memory? If that is the case, calling
> AcceptChanges will just make it so that the state of each row is unchanged.
> Basically, adds, edits, and deletes will be committed (there will not be an
> original row version).
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>
> "ZeroVisio" <ZeroVisio@discussions.microsoft.com> wrote in message
> news:3E3CAA57-7846-40ED-9A54-9CE49EAA7549@microsoft.com...
> > Nicholas,
> >
> > thanks for the reply. I want to just update the dataTable. in my case I'm
> > not using datatable for getting data from any database. it is just a
> > dataholder (i found it easy to use datatable than two dimensional dynamic
> > array for searching certain elements in it).
> > So how do you it. I saw there is something like acceptChanges but I
> > couldn't
> > figure how to make changes! Help!!
> >
> > "Nicholas Paldino [.NET/C# MVP]" wrote:
> >
> >> ZeroVisio,
> >>
> >> If you mean to the back end data source that the data came from, no,
> >> there is not. You will have to create a data adapter that will update
> >> the
> >> table appropriately, and make sure that the table only has the change on
> >> that one row. Once you have that, you can run it through the data
> >> adapter,
> >> and the data on the back end should be updated.
> >>
> >> Hope this helps.
> >>
> >>
> >> --
> >> - Nicholas Paldino [.NET/C# MVP]
> >> - mvp@spam.guard.caspershouse.com
> >>
> >> "ZeroVisio" <ZeroVisio@discussions.microsoft.com> wrote in message
> >> news:3F03C52C-B3AD-4870-B665-CF0164232BA1@microsoft.com...
> >> > Hi,
> >> >
> >> > I want to know if there is an easy way to do update a column of a row
> >> > in
> >> > DataTable.
> >>
> >>
> >>
>
>
>



Relevant Pages

  • Re: Delphi6. ADO <->SQLExpress - best practice?
    ... Unlike BDE and Paradox, dont use tADOTable .. ... can then be committed to the database "optimistically", ... helpful when you have multiple reords being created and dont want to commit ...
    (borland.public.delphi.database.ado)
  • Re: Delphi6. ADO <->SQLExpress - best practice?
    ... Unlike BDE and Paradox, dont use tADOTable .. ... Use tADODataset to read only the data needed for the ... can then be committed to the database "optimistically", ... helpful when you have multiple reords being created and dont want to commit ...
    (borland.public.delphi.database.ado)
  • DataTable, not writing to database
    ... I want to commit all the current records in the DataTable to the ... database and requery the database so that it brings up a fresh datatable ... 'Requery Database ... I dont get any records to return because the never got ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Application Ending : Save the static object in a File to reload it alter !
    ... Why dont you save the information to the database on first created and when ... what is held in memory and reloading it from where you left off is trivial ... "Shanli RICHEZ" wrote in message ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: dataset Performence Issue
    ... Microsoft that a DataSet is okay to abuse as a DataBase. ... Managed Code can never be as fast and as optimized ... very good for 90% of the situations i.e. normal memory usage, ... Merge/GetChanges - and oh lets not forget keeping your disconnected cache ...
    (microsoft.public.dotnet.framework.adonet)