예제 #1
0
        protected int ExcuteInsert()
        {
            int val = -10;

            string InsertCommand = "INSERT INTO [character] ([drugid], [cc14], [cc15], [cc16], [cc17], [cc18], [cc19], [cc20]) VALUES ( @drugid, @cc14, @cc15, @cc16, @cc17, @cc18, @cc19, @cc20)";

            SqlParameter[] par = new SqlParameter[8];

            int idrugid = 0;

            if (Session["drugid"] != null)
            {
                hid_drugid.Value = Session["drugid"].ToString();
                idrugid          = Convert.ToInt32(Session["drugid"].ToString());
            }
            else
            {
                //这个地方还需要再次考虑一下,是否要弹出一个窗口
                Response.Redirect("../Admin/AdWeb/APassport.aspx");
            }
            par[0] = new SqlParameter("@drugid", SqlDbType.Int); par[0].Value = idrugid;
            par[1] = new SqlParameter("@cc14", SqlDbType.NVarChar, 500); par[1].Value = CharText14.TextValue;
            par[2] = new SqlParameter("@cc15", SqlDbType.NVarChar, 500); par[2].Value = CharText15.TextValue;
            par[3] = new SqlParameter("@cc16", SqlDbType.NVarChar, 500); par[3].Value = CharText16.TextValue;
            par[4] = new SqlParameter("@cc17", SqlDbType.NVarChar, 500); par[4].Value = CharText17.TextValue;
            par[5] = new SqlParameter("@cc18", SqlDbType.NText); par[5].Value = RichText18.TextValue;
            par[6] = new SqlParameter("@cc19", SqlDbType.NText); par[6].Value = RichText19.TextValue;
            par[7] = new SqlParameter("@cc20", SqlDbType.NText); par[7].Value = RichText20.TextValue;

            cCharacter cchar = new cCharacter();
            int        gccid = -10;

            try
            {
                val = cchar.ModiCharacter(InsertCommand, par);
                //插入成功之后要取出刚刚插入的ccid
                gccid          = cchar.GetCCid(idrugid.ToString().Trim());
                hid_ccid.Value = gccid.ToString().Trim();
            }
            catch
            { }



            return(val);
        }
예제 #2
0
        protected void DataBindText(string drugid)
        {
            cCharacter cchar = new cCharacter();

            try
            {
                DataTable dt = cchar.GetCharacterDatatable(drugid);
                if (dt.Rows.Count > 0)
                {
                    //把检索出来的表数据绑定到控件上,有数据过来就不能再插入操作了,需要的是更新操作
                    Session["insertCount2"] = "1";
                    hid_ccid.Value          = cchar.GetCCid(drugid).ToString().Trim();
                    hid_drugid.Value        = drugid;

                    CharText14.TextValue = dt.Rows[0]["cc14"].ToString().Trim();
                    CharText15.TextValue = dt.Rows[0]["cc15"].ToString().Trim();
                    CharText16.TextValue = dt.Rows[0]["cc16"].ToString().Trim();
                    CharText17.TextValue = dt.Rows[0]["cc17"].ToString().Trim();
                    RichText18.TextValue = dt.Rows[0]["cc18"].ToString().Trim();
                    RichText19.TextValue = dt.Rows[0]["cc19"].ToString().Trim();
                    RichText20.TextValue = dt.Rows[0]["cc20"].ToString().Trim();
                }
                else
                {
                    Session["insertCount2"] = "0";
                    CharText14.TextValue    = "";
                    CharText15.TextValue    = "";
                    CharText16.TextValue    = "";
                    CharText17.TextValue    = "";
                    RichText18.TextValue    = "";
                    RichText19.TextValue    = "";
                    RichText20.TextValue    = "";
                }
            }
            catch
            { }
        }