示例#1
0
        public Form1()
        {
            InitializeComponent();

            using (CategoriesDL catDL = new CategoriesDL())
            {
                Categories cat = new Categories();
                grdVw.DataSource = catDL.GetTable(cat);//catDL.Categories; //catDL.GetTable(cat);
                grdVw.Refresh();
                cat.CategoryName = "MyNew Category";
                cat.Description  = "New Added Category";
                cat.Picture      = File.ReadAllBytes(@"C:\Users\Krkt\Desktop\suskun.jpg");
                cat.CategoryID   = catDL.InsertAndGetId(cat);
                MessageBox.Show(cat.CategoryID.ToString());
                grdVw.DataSource = catDL.GetTable(cat);
                grdVw.Refresh();
            }
        }