陋室铭
永远也不要停下学习的脚步(大道至简至易)

        public int AddArticleModel(int articleID, string TitleText, string DescriptionText, DateTime CreateDate, string CreateUserText, int DepartmentText, string KeyWordText, int SetTopText)
        {
            SqlCommand sc = new SqlCommand("Article_ArticleModelAdd", myConnection);
            sc.CommandType = CommandType.StoredProcedure;
            object expectedValue = articleID;
            sc.Parameters.Add(new SqlParameter("@articleID", expectedValue));
            expectedValue = TitleText;
            sc.Parameters.Add(new SqlParameter("@Title", expectedValue));
            expectedValue = DescriptionText;
            sc.Parameters.Add(new SqlParameter("@Description", expectedValue));
            expectedValue = CreateDate;
            sc.Parameters.Add(new SqlParameter("@CreateDate", expectedValue));
            expectedValue = CreateUserText;
            sc.Parameters.Add(new SqlParameter("@CreateUser", expectedValue));
            expectedValue = DepartmentText;
            sc.Parameters.Add(new SqlParameter("@CreateDepartment", expectedValue));
            expectedValue = KeyWordText;
            sc.Parameters.Add(new SqlParameter("@KeyWord", expectedValue));
            expectedValue = SetTopText;
            sc.Parameters.Add(new SqlParameter("@SetTop", expectedValue));

            int ID = 0;
            SqlParameter rtnval = sc.Parameters.Add(new SqlParameter("@ID", ID));
            rtnval.Direction = ParameterDirection.Output;
            myConnection.Open();
            sc.ExecuteNonQuery();
            ID = (int)rtnval.Value;
            return ID;
        }

posted on 2006-10-17 13:15  宏宇  阅读(182)  评论(0编辑  收藏  举报