copy datatable
From: Sitar (Sitar_at_discussions.microsoft.com)
Date: 03/18/05
- Next message: maluman: "Re: WaitCursor shows only for a moment"
- Previous message: Vitaly Sedov: "Re: Control for show text with images"
- Next in thread: Peter Foot [MVP]: "Re: copy datatable"
- Reply: Peter Foot [MVP]: "Re: copy datatable"
- Reply: Alex: "RE: copy datatable"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Mar 2005 04:35:02 -0800
Hi,
In my quest for performance, I come up with another question...
There is no DataTable.Copy() with CF and I need to do that. So I came up
with my own implementation which is as follow:
public static DataTable DataTableCopy(DataTable dtOriginal)
{
DataTable dtCopy = dtOriginal.Clone();
try
{
for (int j=0;j<dtOriginal.Rows.Count;j++)
{
dtCopy.ImportRow(dtOriginal.Rows[j]);
}
}
catch(Exception ex)
{
throw new System.Exception("Datatable copy error", ex);
}
return dtCopy;
}
I'm wondering if it is the fastest way to do it though. I use ImportRow
because I need to preserve the RowState values.
Any comment on this?
Thanks,
Sitar.
- Next message: maluman: "Re: WaitCursor shows only for a moment"
- Previous message: Vitaly Sedov: "Re: Control for show text with images"
- Next in thread: Peter Foot [MVP]: "Re: copy datatable"
- Reply: Peter Foot [MVP]: "Re: copy datatable"
- Reply: Alex: "RE: copy datatable"
- Messages sorted by: [ date ] [ thread ]