I'm beginning to think Microsoft has spent the last few years revising .NET so as to break every single programming construct I've developed. Sheesh! Today, I'm trying to figure out where the Generate Dataset context menu option went in VS2005. I used to build quick and dirty config files -- which I could access through a Dataset -- by creating an xml file with dummy data, creating a schema from that xml file, converting the schema to a Dataset, and then selecting Generate Dataset. This created a "hidden" file containing an autogenerated class which I could then read my xml config data into via ReadXml(). Unfortunately, the Generate Dataset menu option has disappeared. Or been moved. And I can't find it. So how do I create a Dataset based on an existing xml file?
Mark, They made the Generic DataSet a lot better. However, you are for sure not the only one who is disapproved about the new IDE and its settings of controls to use that. It seems for me as the IDE was build as betas and never got any reviews. With that killing in my opinion very much of the good work, because it is very difficult to understand how things have to be done. (The same is with the current state to get information from MSDN) You saw already the new Data Tab in your Main Menu bar, that is the one you needs now to create those Generic Datasets from a DataBase. If you want a DataSet from scratch than you have to use them as new Item from by instance the solution explorer menu However the generic dataset is build direct as class (You can see it as you set the view in Solution Explorer to show all files). Because of the fact that the DataAccess is now integrated in Net 2.0 in the generated dataset, do you have less change to need to start everytime again if there is a change in your Designed DataSet, what is of course a real big improvement. I hope this helps, Cor
Cor, I'm glad to see I'm not the only one who's disappointed by how all the changes were handled. It kind of makes me nervous thinking that every couple of years I might have to throw out big chunks of experience just to do simple things. However, I'm still confused about how I build a dataset from a plain xsd schema I've created by hand. What options do I use? I looked at the Data menu again, but I can't create a data source from an XSD schema; the wizard doesn't recognize the schema as a suitable object. Can you walk me through how I do this? Or confirm that it's not possible, so I can stop wasting time on this approach and go find another one :)?
Cor, After some more digging (thanks again for the lead) I've figured out how to create a strongly-typed dataset from a plain old xsd schema: 1) Create the xsd schema (I'll call this the "manual schema" here). 2) Add a new/blank Dataset to the project 3) Open the new Dataset using the Xml Editor (apparently, this option is available only by selecting "Open with..." from the context menu when you right-click the Dataset in Solution Explorer, and then choosing Xml Editor -- you used to be able to do this by switching views in the Dataset visual designer, but that ability has disappeared). 4) Switch the manual xsd schema to xml view. 5) Copy the manual xsd schema information (i.e., everything between the <xs:schema> tags) to the clipboard. 6) Switch to the Dataset xml view window and paste the clipboard info inside the <xs:choice> tags. Putting the information into the right place is important -- if you mess it up (as I did the first time), VS2005 adds a duplicate partial class to the Dataset, which you have to manually delete. You now have a strongly-typed Dataset based on your manually-built xsd schema. Unfortunately, there is a big drawback to this approach: changes made to your manual xsd schema do not get automatically updated in the strongly-typed Dataset. On the other hand, you can simply edit the Dataset itself. That, of course, is what I could've done all along (i.e., created a strongly-typed dataset using the visual designer)...but I got used to doing it by manually creating an xsd schema file (once you learn the particular xsd dialect involved, I find it's much faster to build the dataset schema in a text editor than in the visual designer). So, problem solved. Sort of. But it sure would be nice if Microsoft would stop throwing away big chunks of capability when they bring out their "new and improved" versions of developer tools!
Cor, I know that the dataset visual designer lets you add columns, tables, etc. My point is that the VS2003 approach let me design an XSD schema -- either visually or by editing the schema as an XML file -- and then easily convert it into a strongly-typed dataset. So far as I can tell, that approach is no longer straightforward in VS2005. Which is annoying, since I used to use it a lot. Yes, I found a workaround, but why should I have to find a workaround for something that wasn't broken to begin with? BTW, one other thing I've noticed about using the dataset visual designer in VS2005 versus the "make this xsd schema a dataset" approach in VS2003: If you create a nested schema, e.g: <xs:element name="DataSet1" msdata:IsDataSet="true" > <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="config" > <xs:complexType> <xs:sequence> <xs:element name="subconfig" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="Column1" type="xs:string" minOccurs="0" /> </xs:sequence> <xs:attribute name="abc" type="xs:string" /> <xs:attribute name="def" type="xs:string" /> <xs:attribute name="ghi" type="xs:int" /> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="field1" type="xs:string" /> <xs:attribute name="field2" type="xs:string" /> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> in VS2005 and copy it into the XML source of a dataset the designer automagically generates a key/foreign key/constraint to link the two tables together. VS2003 didn't do this, which was nice for using datasets as config files -- one less field to worry about. I wonder why MS changed the whole XSD/dataset stuff in VS2005? Do you know?
Mark, I could do everything adding a new item dataset from the solution explorer item menu. I did solution explorer Add new item Did a right click and could add a datatable or a dataadapter (which last inludes a wizard for all dataretrieval and the dataset and therefore used the datast) Than I could add a column (using the right button as with all the rest that I did) Than I could change the properties of that. I created this code \\\\ Dim ds As New Mark Dim dr As DataRow = ds.MarkTable.NewRow() dr("Mark") = "Mark" ds.MarkTable.Rows.Add(dr) ds.WriteXml("c:\test1\Mark.xlm") //// And got this file \\\ <?xml version="1.0" standalone="yes"?> <Mark xmlns=" http://tempuri.org/Mark.xsd"> <MarkTable> <Mark>Mark</Mark> </MarkTable> </Mark> /// It was very easy to do. I hope this helps, Cor
Mark, This is for a winform by the way. Cor
Hi Mark, I'm also not quite sure why this was removed, as I'm a support engineer. But it seems that Cor is right. We can only generate a DataSet class from a DataSet xsd in VS.NET 2005. Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Kevin, Thanx for confirming the loss of capability. Can you please suggest that it be considered for restoration? Granted, it's only a convenience. But why take away a convenience?
Hi Mark, Thanks for your feedback. I will forward this to the appropriate team. Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Don't see what you're looking for? Try a search.
|