How to output dataset to .txt file not to .xml?
How can i write the dataset result to text file .txt not to .xml??????????????
or what should i do to save the output results of the two dataAdapters to .txt file or any other file format that could be used as a receipt for new orders
SqlConnection con = new SqlConnection();
con.ConnectionString = "Server=YOUR-0699539F8F\\SQLExpress;Initial Catalog=TheBeerHouse;Integrated Security=true";
SqlDataAdapter da2 = new SqlDataAdapter((" select OrderID, AddedBy, AddedDate, ShippingMethod, ShippedDate, Subtotal, Shipping, ShippingFirstName, ShippingLastName, ShippingStreet, ShippingPostalCode, ShippingCity, ShippingState, ShippingCountry, CustomerEmail, CustomerPhone, CustomerFax from tbh_Orders where OrderID = (select Max(OrderID) from tbh_Orders)"), con);
SqlDataAdapter da = new SqlDataAdapter((" Select OrderID, OrderItemID, Title, TitleA, SKU, UnitPrice, Quantity from tbh_OrderItems where OrderID = (select Max(OrderID) from tbh_OrderItems)"), con);
DataSet myds = new DataSet();
da2.Fill(myds, "Orders");
da.Fill(myds, "OrderItems");
DataRelation rel = myds.Relations.Add("MyRelation", myds.Tables[0].Columns["OrderID"], myds.Tables[1].Columns["OrderID"]);
rel.Nested = true;
myds.WriteXml("c:\\NestedXml3.xml", XmlWriteMode.IgnoreSchema);
Response.Redirect("ThankYou.aspx");
|