|
treuveni wrote: What i'm doing wrong?
That's fairly simple, you've forgotten to add the XML namespace to the query. Typically you would do this using
XNamespace myNamespace = "some namespace";
var query = from response in xmlDoc.Elements(myNamespace + "PersonsMin")
select response;
|
|
|
|
|
Pete O'Hanlon wrote: you've forgotten to add the XML namespace to the query
Like this?
XNamespace myNamespace = "some attribute";<br />
var query = from response in xmlDoc.Elements(myNamespace + "PersonsMin")<br />
select response;
XNamespace is the XAttribute?
|
|
|
|
|
Whereever you see xmlns in your XML, that's the namespace that you need to include to pick it up.
|
|
|
|
|
Pete O'Hanlon wrote: Whereever you see xmlns in your XML, that's the namespace that you need to
include to pick it up.
Still same error
"Sequence contains no elements"
|
|
|
|
|
Try this:
var query = from response in xDoc.Descendants(ns + "PersonsMin")
select response;
|
|
|
|
|
Hi ,
Is there anyway to find a set of words together on visual studio ?.For eg. I need to find 'egg' and 'chicken' together.Could you please let me know .
With regards.
|
|
|
|
|
If you mean the occurrence of these words in your source code then use one of the Edit->Find and Replace ... options from the menu.
If you mean in your resulting program then you will have to write the code yourself.
The best things in life are not things.
|
|
|
|
|
So I didn't have time to look into this exception in detail today. If no one can answer due to the vague nature that's okay. I just thought I could ask and possibly receive some general guidance for in the morning.
Anyhow, I am using C# (.NET 4.0, VS2010) to connect to a MS Access 2007 (.accdb) database. The database includes two tables, "Repairs" and "Scrap Codes". The Repairs table includes a field, "Scrap Code", which does a look-up for values using the Scrap Codes table. All works well within Access. I can successfully insert records (through my software) including a value for the Scrap Code field. I have checked the data in Access to verify proper data is inserted; success.
However, when I execute a simple statement within my software:
<br />
---- To retrieve the most common Scrap Code ----<br />
<br />
SELECT TOP 1 [Scrap Code] FROM Repairs<br />
WHERE [Failure Code]=13<br />
GROUP BY [Scrap Code]<br />
ORDER BY Count(*) DESC<br />
where "Failure Code" is another look-up column in the Repairs table, I receive an exception. In the exception dialog that I receive (the JIT box), instead of displaying a description above the Details button, it simply says "Scrap Codes.", the table name. If the possibilities are not too vague could you please provide a few likely culprits?
Now, if the "Scrap Code" field for EVERY record in Repairs is empty, however, I do not run into this issue at all. But if I set a value for "Scrap Code" on any number of records I get this error.
I will have time to look at it in depth tomorrow morning. But I felt the need to ask because it is going to bother me all night. Haha.
Thanks in advance,
Matt U.
[SOLUTION]
There was a typo in the statement. I had an extra letter at the end of the "Scrap Code" field, in the "Repairs" table. Problem solved.
modified on Thursday, June 16, 2011 6:18 PM
|
|
|
|
|
You don't seem to be joining the two tables, so try this:
SELECT TOP 1 Count(*) AS Expr1, ScrapCodeID
FROM ScrapCodes
INNER JOIN Repairs ON ScrapCodes.ID = Repairs.ScrapCodeID
WHERE FailureCode = 13
GROUP BY Repairs.ScrapCodeID
ORDER BY Count(*) DESC;
The Scrap Codes to Repairs tables above assume a one-to-many relationship - I presume that is what you have.
It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca
|
|
|
|
|
I could give this a try. But I have other fields in the Repairs table which are linked to other tables (the "Failure Code" field, for example, links to the table "Failure Codes"). And I can work with that data without any issue.
I'm not very strong at all on JOIN's yet. It's a subject which I have been reading a lot into lately though.
|
|
|
|
|
|
It is customary and courteous to use a clicky link when posting a URL so people don't have copy and paste the URL, which most will not do and thus you will not receive any positive responses.
Please edit your post and use the link[^] toolbar item.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
It's a command line interface, so you can start the program with Process.Start and talk to it through its redirected stdin/stdout streams (they are available from Process). Obviously to do that it needs to be on the same machine as you are – if it is a *nix-only app then that will mean you will have to run your C# app under Mono.
I didn't investigate in any detail but assuming the app has a sensible command line interface you should be able to write code to talk to it.
|
|
|
|
|
Hi, thank you for the response.
Which program would I want to start, a bash client, in a hidden window?
I will be local on the box, they link gives command lines to return values, but the unix portion of it is what has me confused.
|
|
|
|
|
If it is a tool which takes a command line, executes and closes, then for each 'command' you should start a new process, with the command line you want to send, and capture the output. You can do that with Process.Start (set the ProcessStartInfo up to redirect the console streams). The fact it's on Unix shouldn't matter as long as Mono supports that part of the framework, and I'd be astonished if it doesn't.
|
|
|
|
|
|
I'm not sure, I will have to see if that is possible.
It is a Unix/Solaris SAN server connected to a fiber card of the windows server.
|
|
|
|
|
Hi,
I have a string with the format yyyymmdd.
I'm trying to convert it to date time by DateTime.Parse(myString),
but i'm getting an error.
How can i convert it?
|
|
|
|
|
DateTime.ParseExact("20011215", "yyyyMMdd"); //note the capital M's
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: DateTime.ParseExact("20011215", "yyyyMMdd"); //note the capital M's
What about the IFormatProvider at the constructor?
There is no constructor at the ParseExact that takes 2 parameters
modified on Wednesday, June 15, 2011 3:37 PM
|
|
|
|
|
DateTime d = DateTime.ParseExact("20011215", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
|
|
|
|
|
10x
|
|
|
|
|
In addition to the other answers, there is also Convert.ToDateTime(something)
Always nice to know different methods of doing something.
|
|
|
|
|
That would not help in this case.
|
|
|
|