• 信息内容操作类


    namespace dal
    {
        public class oledo
        {
            private olehelp olehelpex;
            public oledo()
            {
                olehelpex = new olehelp();
            }
            /// <summary>
            /// 选择所有数据
            /// </summary>
            /// <returns></returns>
            public DataTable selectall()
            {
                DataTable dt = new DataTable();
                //dt = olehelpex.execquery("selectall", CommandType.StoredProcedure);
                dt = olehelpex.execquery("SELECT i.id, i.filetitle, i.filecontent, i.filename, i.filedate, c.catename  FROM category AS c INNER JOIN info AS i ON c.id=i.caid order by i.filedate desc", CommandType.Text);
                return dt;
            }
            /// <summary>
            /// 插入
            /// </summary>
            /// <param name="filetitle"></param>
            /// <param name="filecontent"></param>
            /// <param name="filename"></param>
            /// <param name="caid"></param>
            /// <returns></returns>
            public bool insertinfo(string filetitle, string filecontent, string filename, string caid)
            {
                bool flag = false;
                OleDbParameter[] paras = new OleDbParameter[] { new OleDbParameter("@filetitle", filetitle), new OleDbParameter("@filecontent", filecontent), new OleDbParameter("@filename", filename), new OleDbParameter("@caid", caid) };
                int res = olehelpex.execnonquery("insert into info(filetitle,filecontent,filename,caid) values(@filetitle,@filecontent,@filename,@caid)", paras, CommandType.Text);
                if (res > 0)
                {
                    flag = true;
                }
                return flag;
            }
            /// <summary>
            /// 删除
            /// </summary>
            /// <param name="id"></param>
            /// <returns></returns>
            public bool deleinfo(string id)
            {
                bool flag = false;
                OleDbParameter[] paras = new OleDbParameter[] { new OleDbParameter("@id", id) };
                int res = olehelpex.execnonquery("delete from info where id=@id", paras, CommandType.Text);
                if (res > 0)
                {
                    flag = true;
                }
                return flag;

            }
            /// <summary>
            /// 更新
            /// </summary>
            /// <param name="filetitle"></param>
            /// <param name="filecontent"></param>
            /// <param name="caid"></param>
            /// <param name="id"></param>
            /// <returns></returns>
            public bool fixinfo(string filetitle, string filecontent,string caid,string id)
            {
                bool flag = false;
                OleDbParameter[] paras = new OleDbParameter[] { new OleDbParameter("@filetitle", filetitle), new OleDbParameter("@filecontent", filecontent), new OleDbParameter("@caid",caid), new OleDbParameter("@id", id) };
                int res = olehelpex.execnonquery("update info set filetitle=@filetitle,filecontent=@filecontent,caid=@caid where id=@id", paras, CommandType.Text);
                if (res > 0)
                {
                    flag = true;
                }
                return flag;
            }
        }
    }

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data;
    using System.Data.OleDb;
    天道酬勤,厚积薄发。 君子之行,静以修身,俭以养德。 非淡泊无以明志,非宁静无以致远。 如有恒,何须三更起,半夜眠;最怕莫,三天打鱼两天晒网,竹篮打水一场空。
  • 相关阅读:
    男人应该懂得的
    喝酒礼仪
    Office Web Apps开放测试
    SAP系统概要
    SAP实施成功的关键因素
    SAP企业实施的方法论
    ASAP
    ERP系统的组成部分
    去除word的保护
    实习周小结
  • 原文地址:https://www.cnblogs.com/houweidong/p/2924624.html
Copyright © 2020-2023  润新知