|
I´m trying to read a xml file into typed dataset, but I really can´t get it done. Here´s a simple code of what I´m trying to do:
typedDS.ReadXml("d:\\Test.xml");
I don´t get any exception, but there are no records in the dataset. Can anyone help me with this?
cellardoor
|
|
|
|
|
does D:\Test.xml match the schema of the typed dataset?... If it doesn't, you may not have any data in your typed tables, but it may have created a new table from the xml data.
Try iterating through your typedDS.Tables to check this out.
Fan of Donny Darko?
|
|
|
|
|
yes the xml file D:\Test.xml does match the schema of the typed datased. I tryied to validate it first and the validation was successful... I also itarated through the dataset tables and there aren´t any other tables.
cellardoor
|
|
|
|
|
hmmm.... perhaps try:
typedDS.ReadXml("d:\\Test.xml",XmlReadMode.InferTypedSchema);
or XmlReadMode.InferSchema
|
|
|
|
|
thanks now it´s working...
cellardoor
|
|
|
|
|
i don't suppouse d:\Test.xml is an empty file
well, i've been using this method for some time and it works fine for me.
maybe you should try adding some data to the tables in the dataset then ds.WriteXml(file) and then try newDs.ReadXml(file)..
if this will work i'd mean your file is somehow bad, and if not then hmm..
you could also try putting the typedDS.ReadXml("d:\\Test.xml"); in try-carch block.. i had some situations when no error occured and after surrounding code with try-catch exception was handled..
life is study!!!
|
|
|
|
|
comboBoxWorkers.DataSource = PersonsBindingSource;
comboBoxWorkers.DisplayMember = "Name";
comboBoxWorkers.ValueMember = "PersonID";
In the SelectedIndexChanged event query the SelectedValue but it doesn't return the right value.
How can i get the SelectedValue when the user selects a name from the combobox?
|
|
|
|
|
Works for me. What value it is returning? another member?
|
|
|
|
|
It returns the ID but not the ID that match to the selected name.
|
|
|
|
|
That's simply impossible - is the selected text correct?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Better u can try in combobox_selected value event
int i;
i=combobox.selectedValue
Hope this works!
Parimala
|
|
|
|
|
Well, I'm not sure what you're suggesting. The event works, whenever I've used it ( or anyone else )
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Probably, as in the case of selectedIndex changed, i think we cannot get the selected value.
As of my code, i use the selected value property in the selectedvalue changed event.
Parimala
|
|
|
|
|
The SelectedText is "" but the text is correct
|
|
|
|
|
Hello everybody.
I want to write Byte to Hex format in file.
For example:
If byte = 5;
Write 05
If byte = 29;
Write 1D
Thanks for all.
|
|
|
|
|
Use a binary file instead of one that's for writing text.
This [^]looks like a good resource
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I'm using VS.NET 2003. I wanna get the table in a HTML page through WebBrowser object. I can't use the HTMLElement (available in VS2005 only?). I tried the getElementsbytagname but it didnt work.
Pls give me some help
|
|
|
|
|
The only other option is string mashing. Why does getElementByTagName not work ? What is the source HTML ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
This is what i did:
HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument)axWebBrowser.Document;
HTMLElementCollection ecol = (HTMLElementCollection)myDoc.getElementsbyTagName("Table"); <-- Invalid Cast Exception
the HTML source code:
tên sinh viên | : nguyễn hoàng tuấn | mã số sinh viên | : 10360127 | ngày sinh | : 07/01/1985 | hệ đào tạo | : đại học chính quy | ngành học | : tin học (đh) | khóa học | : 2003- 2007 |
Is there anyway simpler to retrieve the data of a table cell in C#? If yes, can i have some sample?
|
|
|
|
|
Why do you cast the return value of the GetElementsByTagName method? According to the docs it already returns a HtmlElementCollection .
Maybe it is just a typo in your posting but your looking for elements with the tag name "Table" (uppercase T), but your HTML only contains elements in lower case namely "table".
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
teeboss wrote: (HTMLElementCollection)myDoc.getElementsbyTagName("Table");
OK, have you tried removing the cast and seeing what comes back ?
Can you control the HTML ? Because I've never used 'getElementsByTagName', getElementById always works fine for me, but this table has no Id. It's also not XHTML, which sucks.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
yeah That table was not done by me so I cant control the HTML code.
SO like i asked, is there anyway I can retrieve data of a table cell?
And Christtian, I'm on Yahoo Messenger now! My ID is mrhoangtuan. If u dont mind add me so we can chat more. I have something to ask u 2.
|
|
|
|
|
Sorry, I don't use yahoo.
The other obvious method is string mashing, just take the text and search for the table directly. It's not pretty, but it would work
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Sry but i'm not good at string mashing. Can u give me some sample?
|
|
|
|
|
Did you try removing the cast to see what that object was returning ? It's a better option.
I'd probably try pulling stuff out with regex, rather than the find methods on the string class, if I had to go that way
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|