TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
A Repasky
NA
231
183.1k
LINQ not working
Jul 19 2011 5:16 PM
My LINQ code is not working. I used this many times before, but in this program it is not working. Here is my code:
static class AutoExtract
{
public static string name = null;
public static string executable = null;
public static string path = null;
public static void Main()
{
try
{
//Get Application Path
path = Output_Files.GetPath();
Console.WriteLine(path);
//Get XML Data
XDocument inputDoc = XDocument.Load(path + @"\AutoExtract.xml");
Console.WriteLine(inputDoc.ToString());
// Query the data
var q = from c in inputDoc.Descendants("AutoExtract")
select new
{
name = (string)c.Attribute("Name"),
executable = (string)c.Attribute("Executable"),
};
foreach (var item in q)
{
name = item.name;
executable = item.executable;
Console.WriteLine("xxx" + item.name + "xxx" + item.executable + "xxx");
//Run process on program
ProcessExtract();
}
Here is my XML file:
<AutoExtract>
<Extract Name="WeeklyExtracts" Executable="C:\WeeklyExtracts\WeeklyExtracts\bin\Debug\WeeklyExtracts.exe">
</Extract>
</AutoExtract>
Does anyone know why this does not work? And it worked with other programs!
Thanks ahead of time.
arep
Reply
Answers (
11
)
How can i be from Zero to Hero in Linq?
Generic-Linq Error in C#.net 2008