Groups | Blog | Home
all groups > inetserver asp general > june 2003 >

inetserver asp general : problem with adding row to datatable


Ray at <%=sLocation%
6/30/2003 8:39:19 AM
This is a classic asp newsgroup. While you may be lucky enough to find a
dotnet-savvy person here who can answer your question, you can eliminate the
luck factor by posting your question to an appropriate group. I suggest
microsoft.public.dotnet.framework.aspnet.

HTH,
Bob Barrows


[quoted text, click to view]

Tom B
6/30/2003 12:55:35 PM
Bob, Ray ??
Ray, are you cutting and pasting Bob's answers?

[quoted text, click to view]

Ray at <%=sLocation%
6/30/2003 1:05:55 PM
I was trying to save Bob some time. :]

Ray at work

[quoted text, click to view]

Bobofrut
6/30/2003 2:05:06 PM
Hi
In my application I try to add one row from datagrid into datatable and I
recive the following message:

Exception Details: System.ArgumentException: This row already belongs to
another table.


The part of code that realize this procedure look:
private void dg1_SelectedIndexChanged(object sender, System.EventArgs e)
{
DataSet ds1 = new DataSet();
string xmlPath;
xmlPath = Server.MapPath("")+"\\ds.xml";
ds1.ReadXml(xmlPath);
DataTable dt = new DataTable();
DataRow dr;
dr = ds1.Tables["person"].Rows[dg1.SelectedIndex];
dt.NewRow();
dt.Rows.Add(dr);
// error occur in this line dg2.DataSource=dt;
dg2.DataBind();
}
Dataset is in xml file and one of tables "person" is binded with dg1
datagrid and I clik into select column of this datagrid for run
dg1_SelectedIndexChanged
I need help
thnks
Bobo

AddThis Social Bookmark Button