none
那位朋友帮我改一下以下三层结构的代码: RRS feed

  • 常规讨论

  • 大家帮我看看怎么才能实现删除成功和失败的提示:

    DAL层:
            //根据ID删除数据
            public bool  DeleteId(FgmasterInfo fgmastetr)
            {
                OracleParameter De_parm = new OracleParameter(":Fgmasterid", OracleType.Char, 50);
                De_parm.Value = fgmastetr.Fgmasterid;

                using (OracleConnection conn = new OracleConnection(OracleHelper.ConnectionStringLocalTransaction))
                {
                    conn.Open();
                    int count =Convert.ToInt32( OracleHelper.ExecuteNonQuery(conn, CommandType.Text, delete_sql, De_parm));
                    if (count > 0)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
    BLL层:
            //根据ID删除记录
            public void DeleteId(FgmasterInfo fgmastetrip)
            {
                FgMasterDAO deid = new FgMasterDAO();
                deid.DeleteId(fgmastetrip);
            }
    UI层:
        //根据ID删除数据

        protected void   Button4_Click(object sender, EventArgs e)
        {
            FgMsaterg deip = new FgMsaterg();
            FgmasterInfo fgmastetrde = new FgmasterInfo();
            fgmastetrde.Fgmasterid = TextBox1.Text.Trim();
            deip.DeleteId(fgmastetrde);

            if (count > 0)
            {
                Response.Write("<font color=red>删除数据成功!</font>");
            }
            else
            {
                Response.Write("<font color=red>删除数据失败!!!!!!!</font>");
            }
    麻烦那位抽个时间帮我看看,三层结构的控制好像不对,那位帮我看看

    2009年6月21日 4:35

全部回复