c# - XDocument to dataSet, my nested nodes are getting treated as new tables? -


Text after "div class =" itemprop = "text">

Looping through the elements thinks that the child node is a table, when it should be just a column Most of the code is working well, as long as the code gets to this part: (All of my code is located below)

  New XElement ("TBL_Magic_TripCountries", LstCountry.Items .Cast & lt; ListItem & gt; () .Where (i = & gt; i.Selected) .Select (X => New XElement ("Country Code", x.Value)),  

I'm receiving The destination table can not access the 'ContraCode'. I have no idea why it thinks this is a table if its located within another node is . I am trying to set Contra Control with TBL_ Magic_TripCountries, but as I thought it was not working? Any Help

  XDocument xmlDoc = New XDocument (New XDeclaration ("1.0", "utf-8", "Yes"), New XComment ("Created:" + DateTime.Now.ToString New XElement ("Trip", "New Ticket" ), New Excellence ("Trip Reinement Comment", TSTRRCR Commment.Text), New Excellence ("TripFermiting", TSTLEcomTime .text), New Excellence ("TBLMGICTreePrinitives", LCTTory Select (x = & gt; New XElement ("Contra Contour", X.Vell), New Exclamation (. "TB L_Cities", lstCities.Items .Cast  (.) Select (x => New XElement ("city", x.Text))),))));  

...

Dataset DS = new dataset (); Ds.ReadXml (xDoc.CreateReader ()); String StrConn = Configuration Manager Connection centers ["myCon"]. ConnectionString; SqlConnection cnn = New SqlConnection (StrConn); SqlBulkCopy blkcopy = new SqlBulkCopy (cnn); Cnn.Open (); Foreign Currency (Datatable DT in DTTs) {BulkPatable (DT, Blackcopy); } Edit My XML looks like this before I start putting in the dataset
   2 & lt; / RegionId> & Lt; OverallRating & gt; 0 & lt; / OverallRating & gt; & Lt; SupplierID & gt; 3 & lt; / SupplierID & gt; & Lt; Supplier Comment & gt; Great Supplier & lt; / Supplier Comment & gt; & Lt; FoodRating & gt; 0 & lt; / FoodRating & gt; & Lt; CulinaryComments & gt; & Lt; / CulinaryComments & gt; & Lt; RecommendRestaurant & gt; False & lt; / RecommendRestaurant & gt; & Lt; AttractionDisappoint & gt; False & lt; / AttractionDisappoint & gt; & Lt; TripRecommendation & gt; False & lt; / TripRecommendation & gt; & Lt; / TBL_TripDetails & gt; & Lt; TBL_Magic_TripCountries & gt; & Lt; CountryCode & gt; United States & lt; / CountryCode & gt; & Lt; CountryCode & gt; CND & lt; / CountryCode & gt; & Lt; / TBL_Magic_TripCountries & gt; & Lt; TBL_Cities & gt; & Lt; City & gt; New York & lt; / City & gt; & Lt; City & gt; Ottawa & lt; / City & gt; & Lt; City & gt; Las vegas & lt; / City & gt; & Lt; / TBL_Cities & gt; & Lt; TBL_Magic_TripTransportation & gt; & Lt; TransportType & gt; 3 & lt; / TransportType & gt; & Lt; TransportType & gt; 4 & lt; / TransportType & gt; & Lt; / TBL_Magic_TripTransportation & gt; & Lt; / Travels & gt;  

I'm not sure that this is the reason, but

<( I => i.Selected). Select (x = & gt; New XElement ("Contra Contro", x.Value))

/ Pre>

An IEnumerable & lt; XElement & gt; And by the dataset will be interpreted as an element with the abundance of 0 .. with. Dataset will internally translate that element into a table because how the dataset handles nested relationships I'm not sure if you have two tables ("TBL_Magic_TripCountries" associated with your main table and then "Countrycode" Linked) or a single table "TBL_Magic_TripCountries" will end in the form of a single column with the country code. It's been too long when I worked with auto-schema-generated datasets.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -