Click here to Skip to main content
15,884,298 members
Home / Discussions / C#
   

C#

 
GeneralRe: TreeNode checking Pin
Member 18598625-Jan-03 11:51
Member 18598625-Jan-03 11:51 
Generalreflection Pin
jtmtv1825-Jan-03 6:21
jtmtv1825-Jan-03 6:21 
GeneralRe: reflection Pin
leppie25-Jan-03 6:43
leppie25-Jan-03 6:43 
Generalleppie read this...(or anyone) Pin
25-Jan-03 10:23
suss25-Jan-03 10:23 
GeneralRe: leppie read this...(or anyone) Pin
leppie25-Jan-03 22:34
leppie25-Jan-03 22:34 
GeneralRe: leppie read this...(or anyone) Pin
James T. Johnson26-Jan-03 6:11
James T. Johnson26-Jan-03 6:11 
GeneralRe: leppie read this...(or anyone) Pin
Paul Riley26-Jan-03 5:29
Paul Riley26-Jan-03 5:29 
GeneralDataRow problem Pin
Mr BallyDaHob25-Jan-03 5:54
Mr BallyDaHob25-Jan-03 5:54 
Hi all,
The function below is used to filter out messages in a DataSet depending on wheather they are between the two dates; "DateTime from" and "DateTime to".
The date of the message is the first column of each row.
(logDataSet is a global variable)

I'm having trouble with this line:
tempDS.Tables["Table"].Rows.Add(logDataSet.Tables["Table"].Rows[i]);
in the below code.
I get the following exception:
"System.ArgumentException
This Row already belongs to another table"

Also, I have tried creating an copy of the DataSet logDataSet (DataSet tempDS = logDataSet), but when I delete rows from the copy it seems to also delete these rows from the global DataSet logDataSet.

Does anyone have any ideas where I am going wrong?
Thanks,
Donal


<br />
// <summary><br />
/// Filters error messages in a data set by their date. But must not change the the original DataSet logDataSet<br />
/// </summary><br />
/// <param name="from">The date from which to filter</param><br />
/// <param name="to">The date to which to filter to</param><br />
/// <returns>A new filtered DataSet</returns><br />
private DataSet filterDates(DateTime from, DateTime to)<br />
{<br />
	//Algorithm for filtering out dates<br />
	DataSet tempDS = logDataSet.Clone();<br />
	for(int i=0;i < logDataSet.Tables["Table"].Rows.Count;i++)<br />
	{<br />
		DateTime fromTime = (DateTime)logDataSet.Tables["Table"].Rows[i][0];<br />
		DateTime toTime = (DateTime)logDataSet.Tables["Table"].Rows[i][0];<br />
		if( fromTime.Date >= from.Date &&  toTime.Date <= to.Date)<br />
		{<br />
			tempDS.Tables["Table"].Rows.Add(logDataSet.Tables["Table"].Rows[i]);<br />
		}<br />
	}<br />
	return tempDS;<br />
}

GeneralRe: DataRow problem Pin
leppie25-Jan-03 6:38
leppie25-Jan-03 6:38 
QuestionIntegrating Flex with C#??? Pin
anjana25-Jan-03 5:34
anjana25-Jan-03 5:34 
AnswerRe: Integrating Flex with C#??? Pin
leppie25-Jan-03 6:34
leppie25-Jan-03 6:34 
QuestionWhat to write? Pin
Skylinemailer25-Jan-03 3:59
Skylinemailer25-Jan-03 3:59 
AnswerRe: What to write? Pin
leppie25-Jan-03 4:33
leppie25-Jan-03 4:33 
AnswerRe: What to write? Pin
Vagif Abilov25-Jan-03 6:16
professionalVagif Abilov25-Jan-03 6:16 
GeneralDateTimePicker Control Pin
Mr BallyDaHob25-Jan-03 3:33
Mr BallyDaHob25-Jan-03 3:33 
GeneralRe: DateTimePicker Control Pin
leppie25-Jan-03 4:43
leppie25-Jan-03 4:43 
GeneralRe: DateTimePicker Control Pin
Mr BallyDaHob25-Jan-03 5:39
Mr BallyDaHob25-Jan-03 5:39 
QuestionC# RegEx text parsing??? Pin
Kevin S.24-Jan-03 10:03
Kevin S.24-Jan-03 10:03 
QuestionTcpListener Hangs at 4096 bytes? Pin
Daniel Bright24-Jan-03 9:01
Daniel Bright24-Jan-03 9:01 
AnswerRe: TcpListener Hangs at 4096 bytes? Pin
Heath Stewart24-Jan-03 10:14
protectorHeath Stewart24-Jan-03 10:14 
AnswerRe: TcpListener Hangs at 4096 bytes? Pin
Stephane Rodriguez.24-Jan-03 10:18
Stephane Rodriguez.24-Jan-03 10:18 
QuestionHow do I draw on a bitmap? Pin
MikeBeard24-Jan-03 8:48
MikeBeard24-Jan-03 8:48 
AnswerRe: How do I draw on a bitmap? Pin
Heath Stewart24-Jan-03 8:55
protectorHeath Stewart24-Jan-03 8:55 
GeneralRe: How do I draw on a bitmap? Pin
MikeBeard24-Jan-03 9:01
MikeBeard24-Jan-03 9:01 
GeneralRe: How do I draw on a bitmap? Pin
Heath Stewart24-Jan-03 10:11
protectorHeath Stewart24-Jan-03 10:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.