SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Generate dataset...

Last post 09-23-2006 10:06 PM by Peter Forstmeier. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 09-07-2006 8:48 PM

    • ygmail
    • Not Ranked
    • Joined on 09-07-2006
    • Posts 1

    Generate dataset...

    Since a while I am using SharpDevelop and I have to say: it looks great! Before SharpDevelop I used VS.net 2003.

    Now I have converted succesfully a VS.net 2003 project into SharpDevelop (v2 build 1710). So far so good. In this project (in VS.net 2003) I always used the option "Cenerate dataset" from the dropdown of the OledbDataAdapter. This always generated the .xsd files. These imported files work great within SharpDevelop, but I can not generate them within SharpDevelop!!!

    Is there some kind of feature like "Generate dataset" like in VS.net 2003? I like that function very much. Or is there some alternative? I use MS Access (.mdb) databases.

    Thanks,

    Jasper

    (By the way: maybe my English is not very well, this because I am Dutch)

  • 09-14-2006 3:06 AM In reply to

    • taxus
    • Top 150 Contributor
    • Joined on 04-28-2006
    • Québec, QC, Canada
    • Posts 18

    Re: Generate dataset...

    ygmail:
    Is there some kind of feature like "Generate dataset" like in VS.net 2003? I like that function very much. Or is there some alternative? I use MS Access (.mdb) databases.

    No, I don't think there is. Check this thread. But there is the hard way.

    I'm a user of Visual Studio .NET 2003 myself (at work), and I explored typed datasets in #d just yesterday. Here is what I found about building typed datasets in #d.

    1. You have to manually edit a dataset schema as a XSD schema file (add an empty XML file to your project and name it with the .xsd extension). You need to have a good knowledge of the XSD schema for that.

    The XSD schema definition can be found on the W3 Consortium Web site and on MSDN Library. The "Working With A Typed Dataset" section in MSDN Library gives a good example.

    2. Microsoft extended the schema with its own additions for use of datasets.

    When you edit a schema with the VS.NET XML Editor, you can set dataset properties which are represented in the schema by attributes in the msdata namespace (urn:schemas-microsoft-com:xml-msdata).

    For example, to have a DataColumn behave as an autonumber (as in Access), you set its AutoIncrement property to "True", or it can be set as such in the XML Editor. In the schema, it's represented as a msdata:AutoIncrement="True" attribute. Such dataset properties that are not part of the standard XSD schema seem to be available in the msdata namespace.

    Well, this msdata schema is not documented anywhere. I only found a reference to it on MSDN Library in a page about the XML Editor Schema Cache. That led me to the msdata XSD Schema, which is installed by VS.NET (I had installed Visual Web Developer 2005 before). So if you want to set a special dataset property (not part of the standard XSD schema, that is), you can check if it exists in the msdata.xsd file. (In other words, check first in the dataset and datacolumn documentation in the .NET Class Library reference, and if you see a property you want to use, check its existence in msdata.xsd.)

    There are also annotations defined by the codegen namespace, but they're documented in MSDN Library.

    The schema can also be generated from a XML file; see the documentation for XSD.EXE, which I discuss on next point.

    3. Once your XSD schema is ready, you can manually generate the code behind with the XSD.EXE command-line tool which comes with the .NET Framework SDK. It is also documented on MSDN Library. I suggest you use the .NET Framework SDK command-line shortcut in the Start menu rather that the regular command-line, since it configures the .NET command-line utilities folder in the default path.

    4. Once the code behind file (.VB or .CS) is generated, import it in your projet (add an existing file).

    That's it. The hard part is making the XSD. Well, it's not that hard, just tedious.

    ygmail:
    (By the way: maybe my English is not very well, this because I am Dutch)

    Don't worry. (By the way, it's "my English is not very good".) I'm a French speaker myself, and many here aren't native English speakers.

    In any case, here is the msdata schema (msdata.xsd). I guess it could be possible to add it to the XML Schemas options so code completion works with the #d XML editor.

    <?xml version="1.0" encoding="utf-8" ?>
    <xs:schema version="1.1.0" targetNamespace="urn:schemas-microsoft-com:xml-msdata"
    elementFormDefault="qualified"
    attributeFormDefault="qualified"
    xmlns="urn:schemas-microsoft-com:xml-msdata"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:attribute name="AcceptRejectRule" type="xs:string" default="none">
    </xs:attribute>
    <xs:element name="Relationship">
    <xs:complexType>
    <xs:sequence />
    <xs:attribute name="RelationName" type="xs:string">
    </xs:attribute>
    <xs:attribute name="parent" type="xs:string">
    </xs:attribute>
    <xs:attribute name="child" type="xs:string">
    </xs:attribute>
    <xs:attribute name="parentKey" type="xs:string">
    </xs:attribute>
    <xs:attribute name="childKey" type="xs:string">
    </xs:attribute>
    </xs:complexType>
    </xs:element>

    <xs:attribute name="ColumnName" type="xs:string">
    </xs:attribute>


    <xs:attribute name="ConstraintName" type="xs:string">
    </xs:attribute>
    <xs:attribute name="ConstraintOnly" type="xs:boolean">
    </xs:attribute>

    <xs:attribute name="CaseSensitive" type="xs:boolean" default="false">
    </xs:attribute>
    <xs:attribute name="DeleteRule" type="xs:string" default="cascade">
    </xs:attribute>


    <xs:attribute name="Error" type="xs:string">
    </xs:attribute>
    <xs:attribute name="IsDataSet" type="xs:boolean" default="false">
    </xs:attribute>
    <xs:attribute name="IsNested" type="xs:boolean" default="false">
    </xs:attribute>
    <xs:attribute name="Locale" type="xs:string" default="en-us">
    </xs:attribute>

    <xs:attribute name="Ordinal" type="xs:integer">
    </xs:attribute>
    <xs:attribute name="UpdateRule" type="xs:string" default="cascade">
    </xs:attribute>


    <xs:attribute name="rowOrder" type="xs:integer">
    </xs:attribute>
    <xs:attribute name="hiddenColumn" type="xs:boolean">
    </xs:attribute>
    <xs:attribute name="EnforceConstraints" type="xs:boolean">
    </xs:attribute>

    <xs:attribute name="Prefix" type="xs:string" default="">
    </xs:attribute>

    <xs:attribute name="AutoIncrementSeed" type="xs:long">
    </xs:attribute>
    <xs:attribute name="AutoIncrement" type="xs:boolean" default="false">
    </xs:attribute>
    <xs:attribute name="AutoIncrementStep" type="xs:long" default="1">
    </xs:attribute>
    <xs:attribute name="Caption" type="xs:string">
    </xs:attribute>
    <xs:attribute name="ReadOnly" type="xs:boolean" default="false">
    </xs:attribute>

    <xs:attribute name="Sparse" type="xs:boolean" default="false">
    </xs:attribute>

    <xs:attribute name="AllowDBNull" type="xs:boolean" default="true">
    </xs:attribute>
    <xs:attribute name="DataType" type="xs:string">
    </xs:attribute>
    <xs:attribute name="DefaultValue" type="xs:string">
    </xs:attribute>
    </xs:schema>

    Taxus

  • 09-14-2006 8:33 AM In reply to

    Re: Generate dataset...

    Hi,

    as a workaround you can generate DataSets by using SharpReport.

    Start the Wizard, Select PullModel-Report on the first Wizard Page.

    On the second Wizard Page create a connection and a SqlStatement

    The thierd Wizard Page shows the QueryResults. The ContextMenu of the DataGrid lets you save the Results as a Plain *.xsd File or *.xsd including the selected data.

    Hope this helps.

    Peter

     

  • 09-22-2006 4:40 PM In reply to

    Re: Generate dataset...

    How do I start the wizard? The only thing I have found is under tools > Report Generator, but that does not start a wizard, it only brings up a blank report page.

     Ian
     

  • 09-23-2006 1:12 AM In reply to

    • taxus
    • Top 150 Contributor
    • Joined on 04-28-2006
    • Québec, QC, Canada
    • Posts 18

    Re: Generate dataset...

    If you add a SharpReport file to your project, the Report Wizard is automatically displayed. I don't know any other way to display it, but then I'm a beginner with #d.
  • 09-23-2006 10:06 PM In reply to

    Re: Generate dataset...

    Hi Ian,

    you can start the wizard with File\New\ from the MainMenu

     Peter

     

    Filed under:
Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.