datagridview绑定源3layer [英] datagridview binding source 3layer

查看:80
本文介绍了datagridview绑定源3layer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

这个源代码有rine时间错误

plzzzzzzzzzzzzzzzzzzzzzz帮助我

============ ========================

hello
this source code have rine time error
plzzzzzzzzzzzzzzzzzz help me
====================================

namespace project1.DAL.Services
{
    public class CategoryService
    {

        public static void AddCategory(Category category)
        {
            try
            {
                SqlParameter[] pr = null;

                pr = new SqlParameter[1];

                pr[1] = new SqlParameter("@c", System.Data.SqlDbType.NVarChar, 20);
                pr[1].Value = category.CG;
                Data.ExecuteInsertQuery("addcategory", pr);


            }
            catch
            {
                throw;
            }

        }


    }



======== ==============================

BAL

categoryBAL


======================================
BAL
categoryBAL

namespace project1.BAL.Controllers
{
  public  class CategoryBAL
    {
      public  static bool InsertCategory(Category ctg  )
      {

          try
          {
              CategoryService.AddCategory(ctg);

              return true;
          }
          catch
          {

              throw;
          }
      }
    }
}





======= =============================

UI



====================================
UI

private void ADDCATEGORY_Click(object sender, EventArgs e)
       {
           try
           {
               Comman.Entities.Category c1 = new Comman.Entities.Category();
              BAL.Controllers.CategoryBAL.InsertCategory(c1);

               bindingSource1.Add(c1);
               dataGridView1.DataSource = bindingSource1;
               MessageBox.Show("عملیات با موفقیت انجام شد");
this.Close();
           }
           catch (Exception d)
           {

               MessageBox.Show(d.Message, "error");
           }

       }

推荐答案

如何删除这篇文章???我不要知道如何删除这篇文章
how do i delete this post???i don not know how delete this post


对不起我不知道如何删除这篇帖子

i最近加入了代码项目

plzz help我庆祝老师
sorry i don't know how delete this post
i have recently joined to code project
plzz help me celebrate teachers


这篇关于datagridview绑定源3layer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆