Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Data;
- namespace Siswa__dan_Mapel
- {
- class Program
- {
- static void Main(string[] args)
- {
- //buat table1
- DataTable Table1 = new DataTable("tabelsiswa");
- Table1.Columns.Add("id");
- Table1.Columns.Add("nama");
- Table1.Rows.Add(1, "okie");
- Table1.Rows.Add(2, "nega");
- //buat table2
- DataTable Table2 = new DataTable("tabelmapel");
- Table2.Columns.Add("mapelid");
- Table2.Columns.Add("pelajaran");
- Table2.Rows.Add(1, "matematika");
- Table2.Rows.Add(2, "ipa");
- //buat dataset dan tambahkan table ke dataset
- DataSet MyDataset = new DataSet("percobaan");
- MyDataset.Tables.Add(Table1);
- MyDataset.Tables.Add(Table2);
- //tampilkan di console
- Console.WriteLine(MyDataset.GetXml());
- //Console.WriteLine(MyDataset.GetXmlSchema());
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement