Need Help From Expert

  • Thread starter Thread starter Kate Luu
  • Start date Start date
K

Kate Luu

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.AutoIncrement = true;
people.PrimaryKey = 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.AcceptChanges();
try
{
StreamWriter writer = new StreamWriter( strPersonSchema );
datadoc.DataSet.WriteXmlSchema( writer );
if( writer != null )
writer.Close();
}
catch( Exception Err )
{
MessagBox.Show( Err.Message.ToString() );
}
 
Kate Luu said:
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...

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top