PC Review


Reply
Thread Tools Rate Thread

Delete Row (XML) Compiler Error

 
 
Aaron
Guest
Posts: n/a
 
      23rd Nov 2004
I got this code off of a Microsoft knowledge base article which was written
in VB .NET and I translated (or tried) it into C# with only one error:

DataSet toolDS;
string xmlFileName;
xmlFileName = "\\Program Files\\Tools\\pnmd.xml";

//Delete tool by tool name
string ID = "", expr = "";
//Set search criteria
expr = "ID = '" + cmbTool.Text + "'";
//Remove row
toolDS.Tables["Tools"].Rows.Remove(toolDS.Tables["Tools"].Select(expr)(0));
//Save data
toolDS.AcceptChanges();
toolDS.WriteXml(xmlFileName);

The compiler error I get is "Method name expected" at this area (which the
compiler underlines):

toolDS.Tables["Tools"].Select(expr)

What am I doing wrong or missing...can anyone help?

Thanks


 
Reply With Quote
 
 
 
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      23rd Nov 2004
This
toolDS.Tables["Tools"].Rows.Remove(toolDS.Tables["Tools"].Select(expr)(0));
should be
toolDS.Tables["Tools"].Rows.Remove(toolDS.Tables["Tools"].Select(expr)[0]);

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Aaron" <(E-Mail Removed)> wrote in message
news:IsBod.10$(E-Mail Removed)...
>I got this code off of a Microsoft knowledge base article which was written
> in VB .NET and I translated (or tried) it into C# with only one error:
>
> DataSet toolDS;
> string xmlFileName;
> xmlFileName = "\\Program Files\\Tools\\pnmd.xml";
>
> //Delete tool by tool name
> string ID = "", expr = "";
> //Set search criteria
> expr = "ID = '" + cmbTool.Text + "'";
> //Remove row
> toolDS.Tables["Tools"].Rows.Remove(toolDS.Tables["Tools"].Select(expr)(0));
> //Save data
> toolDS.AcceptChanges();
> toolDS.WriteXml(xmlFileName);
>
> The compiler error I get is "Method name expected" at this area (which the
> compiler underlines):
>
> toolDS.Tables["Tools"].Select(expr)
>
> What am I doing wrong or missing...can anyone help?
>
> Thanks
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible VS2003 c# compiler bug: error CS0584: Internal Compiler Error: stage 'COMPILE' symbol '' eblanco Microsoft Dot NET Framework 0 28th Jul 2006 09:40 PM
Compiler Error Message: The compiler failed with error code -1073741819 Ram Microsoft ASP .NET 0 13th Sep 2005 10:52 AM
fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'f:\vs70builds\3077\vc\Compiler\Utc\src\P2\main.c', line 148) PufferFish Microsoft VC .NET 10 6th Aug 2004 10:33 PM
fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2701) =?Utf-8?B?TWFyY28gTm92YQ==?= Microsoft VC .NET 9 27th Apr 2004 06:55 PM
Compiler Error Message: The compiler failed with error code 128. Yan Microsoft ASP .NET 0 21st Jul 2003 11:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:09 PM.