Need Help From Expert

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kate Luu

    Need Help From Expert

    I have down load some source codes from the internet and it wasn't worked
    right, but I'm really know what's wrong about it. May some expert help me
    please...I'm deeply appreciated for your help. Have a nice day...

    Kate



    the code look like this:


    string strPersonSchema = "PersonPet.xsd" ;

    XmlDataDocument datadoc = new XmlDataDocument ();
    datadoc.Dataset .DataSetName = "PersonPet" ;

    // Create tables for people and pets
    DataTable people = new DataTable( "Person" );

    // Set up the columns in the Tables
    DataColumn personname = new DataColumn( "Name", typeof(String) );
    DataColumn personAge = new DataColumn( "Age", typeof(Int32) );

    // Add columns to person table
    DataColumn id = people.Columns. Add( "ID", typeof(Int32) );
    id.AutoIncremen t = true;
    people.PrimaryK ey = new DataColumn[]{ id };
    people.Columns. Add( personname );
    people.Columns. Add( personAge );

    // Add tables to the DataSet
    datadoc.Dataset .Tables.Add( people );

    // Create new Row
    DataRow mark = people.NewRow() ;
    mark[personname] = "Mark";
    mark[personAge] = 18;
    people.Rows.Add ( mark );

    // commit changes
    dataset.AcceptC hanges();
    try
    {
    StreamWriter writer = new StreamWriter( strPersonSchema );
    datadoc.DataSet .WriteXmlSchema ( writer );
    if( writer != null )
    writer.Close();
    }
    catch( Exception Err )
    {
    MessagBox.Show( Err.Message.ToS tring() );
    }


  • Jon Skeet [C# MVP]

    #2
    Re: Need Help From Expert

    Kate Luu <cql60@yahoo.co m> wrote:[color=blue]
    > I have down load some source codes from the internet and it wasn't worked
    > right, but I'm really know what's wrong about it. May some expert help me
    > please...I'm deeply appreciated for your help. Have a nice day...[/color]

    Could you tell us what you're hoping it will do, and in what way it
    fails to do that?

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    Working...