December 19, 2006 at 11:01 am
I am not sure whether this is a proper place to ask this question, but hoping someone might know:
I read a database into a DATASET in C#. I then output it as an XML file. In the XML file, the tables (which initially resided in my db) are called Table, Table1, Table2 ... respectively.
As such, when I query the XML file (i.e. the tables), I have to use these labels. Would anyone know how I can retain the orignal table names when the XML file is created from the Dataset?
Thank you very much
December 20, 2006 at 6:47 am
You can apply a tablemapping on your data adapter (I assume you have tables with real name MyTable1Name and MyTable2Name: put your names here)
da is your data adapter
da.TableMappings.Add("Table", "MyTable1Name");
da.TableMappings.Add("Table1", "MyTable2Name");
Then do your fill.
Russel Loski, MCSE Business Intelligence, Data Platform
December 20, 2006 at 8:01 pm
use ds.readXml then,
isn't there a ds.Tables(0).tableName or something?
December 20, 2006 at 8:34 pm
Sorry, after rereading your post, I realized I misunderstood you. Here you go...
da.Fill(ds, "YourTableName);
da2.Fill(ds, "YourNextTableName);
ds.SaveXML("path");
December 21, 2006 at 1:26 pm
Guys,
Thanks for all the help.
I solved the problem by using what was stated in one of the postings above. Namely,
Dataset.Tables[0].TableName = "Real Name"
December 21, 2006 at 2:05 pm
Merry Christmas! ß Click Here
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply