Пример #1
0
        //365存入金额
        //public string SaveTSFIn(string mJE, string mDate)
        //{
        //    SqlConnection conn = new SqlConnection(sql);
        //    SqlCommand cmd = conn.CreateCommand();
        //    cmd.CommandText = string.Format("insert into tb_plan_detail (je,Svdate) values ({0},'{1}')",je,DateTime.Now.ToString("yyyy-MM-dd"));
        //    conn.Open();
        //    int result = cmd.ExecuteNonQuery();

        //    //关闭数据库
        //    conn.Close();
        //    return "";
        //}

        //存入金额
        public string SaveIn(string je)
        {
            //SqlConnection conn = new SqlConnection(sql);
            //SqlCommand cmd = conn.CreateCommand();
            //cmd.CommandText = string.Format("insert into tb_plan_detail (je,Svdate) values (@je,@Svdate)", je, );
            //conn.Open();
            //int result = cmd.ExecuteNonQuery();
            string mSql = "insert into tb_plan_detail (je,Svdate,UserID) values (@je,@Svdate,@UserID)";

            SqlParameter[] sp = new SqlParameter[3];
            sp[0] = new SqlParameter("@je", je);
            sp[1] = new SqlParameter("@Svdate", DateTime.Now.ToString("yyyy-MM-dd"));
            sp[2] = new SqlParameter("@UserID", "MguliN");
            return(sh.InsertNew(mSql, sp));
        }