Sunday, March 04, 2007

DataTable already belongs to another DataSet & DataRow already belongs to another DataRow.

Error: DataTable already belongs to another DataSet
Try in this way to copy data table from data set to another data set.
DataSet ds = new DataSet();
ds = GetDataSet();
ds.Tables[0].TableName = "Old";
DataSet dsNew = new DataSet();
DataTable dt = ds.Tables[0];
ds.Tables.Remove(dt);
dt.TableName = "New";
dsNew.Tables.Add(dt);
Error : DataRow already belongs to another DataRow.
Copy data Row from one data table to another data table
DataTable dt = new DataTable();
Use ImportRow Instead of Row.Add (dt.Rows.Add(dataRow);)
dt.ImportRow(dataRow);
Get Updated Row state
This GetChanges method will give the updated row from original dataset.
And RowState method will give the state “Updated”,“Deleted”,”Inserted”

dsDataSet.GetChanges()
dsDataSet.Table[0].GetChages()
string updateMode = dsDataSet.Tables[0].Rows[rowNumber].RowState.ToString();
Create DataSet from DataRow.
private DataSet GetFilterChildRecords(DataSet dsMainDataSet,string whereCondition)
{
try
{
DataRow[] dr = dsMainDataSet.Tables[1].Select(whereCondition);
dsSetActCode_Details = dsMainDataSet.Clone();
for (int i = 0 ;i<dr.Length ;i++)
{
DataRow drNew = dsSetActCode_Details.Tables[1].NewRow();
dsSetActCode_Details.Tables[1].Rows.Add(drNew);
for (int j = 0; j < dr[i].ItemArray.Length; j++)
{
dsSetActCode_Details.Tables[1].Rows[i][j] = dr[i][j];
}
}
return dsSetActCode_Details;
}
catch(Exception Ex)
{
throw Ex;}
}

3 comments:

Anonymous said...

Hello everyone! Who knows where to upload the film Avatar?
I even bought the film Avatar for a SMS to http://rsskino.ru/kinofilm/avatar.html , the link was, but download fails, the system will boot quite strange cocoa something.
Men, advise where to normal as quickly download film avatar?

Anonymous said...

I sell a boat-program which will help you to outwit auction and to win, initially the boat was created for the Scandinavian auction http://internet-aukcion.ru/ but now the program can work with similar auctions: gagen ru, vezetmne ru and with ten.
The program-boat stakes for you, i.e. for this purpose it is not necessary to sit constantly at the monitor. The boat can set time when it is necessary to stake, thus you as much as possible will lower expenses for rates, and as much as possible increase the chances of a victory.

The price of the program a boat for the Scandinavian auctions 20$

For the first 10 clients the price 15$

To all clients free updating and support.

Behind purchases I ask in icq: 588889590 Max.

Anonymous said...

[b]Set software LoveBots v 5.2[/b]

All for a mass mailing dating http://24lux.ru/

The script is written in php5

Features:

[i]registration, account activation
manual input captures, or the solution through antikapchu
filling data accounts:
- Gulf desired photo
- Инфы about yourself
- Diary
- Sexual preference[/i]

gulyalka on questionnaires spammer on lichku
- Randomization Posts: replacement of Russian letters in Latin analogues

optimized to work in a continuous loop
check-activation-filling-spam check ..

Updates and support free of charge.

Price per set 100 wmz

For the first 10 buyers price 70 wmz (your feedback on the software).

For shopping I ask in icq: 588889590 Max.

Scrin program:

[IMG]http://i066.radikal.ru/1002/9d/a7a68e8c96ee.jpg[/IMG]

[IMG]http://i054.radikal.ru/1002/19/9db76967c0e5.jpg[/IMG]

[IMG]http://s003.radikal.ru/i202/1002/24/20716e86512e.jpg[/IMG]

Flooding in the subject no! Write to feedback after the purchase.