Tuesday 18 October 2016

c# typed dataset



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TypedDatasetDemo
{
    public partial class Form1 : Form
    {
        //Inventory db = new Inventory();
        InventoryTableAdapters.SupplierTableAdapter adapter =
            new InventoryTableAdapters.SupplierTableAdapter();
        public Form1()
        {
            InitializeComponent();
            //adapter.Fill(db.Supplier);
            //uxSuppliers.DataSource = db.Supplier;
            uxSuppliers.DataSource = adapter.GetData();
        }

        private void uxOK_Click(object sender, EventArgs e)
        {
            //var row = db.Supplier.NewSupplierRow();
            //row.Name = uxName.Text;
            //db.Supplier.Rows.Add(row);
            //adapter.Update(db.Supplier);
            adapter.Add(uxName.Text);
            uxSuppliers.DataSource = adapter.GetData();
        }
    }
}

No comments:

Post a Comment