hi guys help please.
Currently i have a code below that Supposedly copy the structure of the Dataset "ds" to Dataset "tmpds" and perform a logical test and if it is true a Datarow from Table1 of "ds" Dataset will be copied or Add to Table1 of "tmpds" Dataset but it has an error (See the Code in Bold letters)
CODE:
ERROR:Code:DataSet FuncTrimValidity(DataSet ds) { DataSet tmpds = ds.Clone(); DataRow dr;// = new DataRow(); try { //My logical test here if if it is true perform the code below //IF(My logic Test){ //But this does not matter to my question dr = ds.Tables[1].Rows[0]; tmpds.Tables[1].Rows.Add(dr); //Error Occurs Here //} } catch (Exception ex) { MessageBox.Show(ex.Message); } return tmpds; }
Any suggestion guys to solve the problem? Thanks in advance!"This row already belongs to another table."




Reply With Quote