当前位置: 首页>>代码示例>>C#>>正文


C# DataBase.RunProcReturn方法代码示例

本文整理汇总了C#中DataBase.RunProcReturn方法的典型用法代码示例。如果您正苦于以下问题:C# DataBase.RunProcReturn方法的具体用法?C# DataBase.RunProcReturn怎么用?C# DataBase.RunProcReturn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataBase的用法示例。


在下文中一共展示了DataBase.RunProcReturn方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDing

 /// <summary>
 /// 获取顶的信息
 /// </summary>
 /// <param name="nId">注释的ID</param>
 /// <param name="uId">用户的ID </param>
 /// <param name="isDing">顶操作的类型 1为顶 0为踩</param>
 /// <returns></returns>
 public static DingEntity GetDing(int nId,int uId, int isDing)
 {
     DataBase db = new DataBase();
     DataSet rs = db.RunProcReturn("select * from tb_Ding where nid=" + nId +"and uid=" + uId, "tb_Ding");
     DataSet rs1 = db.RunProcReturn("select * from tb_note where id=" + nId , "tb_note");
     int ding = int.Parse(rs1.Tables[0].Rows[0]["agree"].ToString());
     int cai = int.Parse(rs1.Tables[0].Rows[0]["disagree"].ToString());
     int ID = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
     ding = ding + 1;
     cai = cai + 1;
     if (rs.Tables[0].Rows.Count >= 1)
     {
         if (isDing ==1 )
         {
             string sql1 = "UPDATE tb_note SET agree =" + ding + " where id="+nId;
             db.ExCommandNoBack(sql1);
         }
         else if(isDing == 0)
         {
             string sql2 = "UPDATE tb_note SET disagree =" + cai+ " where id=" + nId;
             db.ExCommandNoBack(sql2);
         }
     }
     /*else
     {
         string sql3 = "delete from dbo.tb_Ding where id=" + ID + "";
         db.ExCommandNoBack(sql3);
     }*/
     return null;
 }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:37,代码来源:DingOperation.cs

示例2: AddDing

    /// <summary>
    /// 添加顶操作
    /// </summary>
    /// <param name="de">顶的实例</param>
    /// <returns>添加成功返回true 失败返回false</returns>
    public static bool AddDing(DingEntity de)
    {
        DataBase db = new DataBase();
        try
        {
            string sql = string.Format("INSERT INTO tb_Ding (nid,uid,isDing) VALUES  ( '{0}', '{1}','{2}')", de.Nid, de.Uid, de.isDing);
            db.ExCommandNoBack(sql);
            DataSet rs = db.RunProcReturn("select * from tb_Ding where nid=" + de.Nid + "and uid=" + de.Uid, "tb_Ding");
            int ID = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
            if (rs.Tables[0].Rows.Count == 1)
            {
                return true;
            }
            else
            {
            string sql3 = "delete from dbo.tb_Ding where id=" + ID + "";
            db.ExCommandNoBack(sql3);
            return false;
            }

        }
        catch
        {
            return false;
        }
    }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:31,代码来源:DingOperation.cs

示例3: GetAM

 public static AnnouncementEntity GetAM(int id)
 {
     DataBase db = new DataBase();
     DataSet rs = db.RunProcReturn("select * from tb_announcement where id=" + id, "tb_announcement");
     if (rs.Tables[0].Rows.Count > 0)
     {
         AnnouncementEntity ae = new AnnouncementEntity();
         ae.Id=int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
         ae.Uid = int.Parse(rs.Tables[0].Rows[0]["uid"].ToString());
         ae.AmTitle = rs.Tables[0].Rows[0]["amtitle"].ToString();
         ae.Essay = rs.Tables[0].Rows[0]["essay"].ToString();
         ae.Time = DateTime.Parse(rs.Tables[0].Rows[0]["uptime"].ToString());
         return ae;
     }
     return null;
 }
开发者ID:gqb101112,项目名称:ZCoder,代码行数:16,代码来源:AnnouncementOperation.cs

示例4: GetProject

 public static ProjectEntity GetProject(int projectId)
 {
     /*获取工程信息*/
     DataBase db = new DataBase();
     DataSet rs = db.RunProcReturn("select * from tb_project where id=" + projectId, "tb_project");
     if (rs.Tables[0].Rows.Count > 0)
     {
         ProjectEntity pe = new ProjectEntity();
         pe.ProjectName = rs.Tables[0].Rows[0]["projectName"].ToString();
         pe.Uid = int.Parse(rs.Tables[0].Rows[0]["uid"].ToString());
         pe.Tid = int.Parse(rs.Tables[0].Rows[0]["tid"].ToString());
         pe.UpTime = DateTime.Parse(rs.Tables[0].Rows[0]["uptime"].ToString());
         pe.Id = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
         pe.Description = rs.Tables[0].Rows[0]["description"].ToString();
         return pe;
     }
     return null;
 }
开发者ID:gqb101112,项目名称:ZCoder,代码行数:18,代码来源:ProjectOperation.cs

示例5: CancelRecommend

 /// <summary>
 /// 取消推荐操作
 /// </summary>
 /// <param name="noteId">注释的ID</param>
 /// <returns></returns>
 public static int CancelRecommend(int noteId)
 {
     DataBase db = new DataBase();
     string sql = "select recommend from tb_note where id='" + noteId + "'";
     string sql1 = "update tb_note set recommend='" + 0 + "' where id='" + noteId + "'";
     DataSet ds = db.RunProcReturn(sql, "tb_note");
     /*如果本就未被推荐,则返回0*/
     if (int.Parse(ds.Tables[0].Rows[0]["recommend"].ToString()) == 0)
     {
         return 0;
     }
     /*如果已被推荐,则返回1*/
     else
     {
         db.ExCommandNoBack(sql1);
         return 1;
     }
 }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:23,代码来源:NoteOperation.cs

示例6: GetComment

    public static CommentEntity GetComment(int commentId)
    {
        /*获取评论信息*/
        DataBase db = new DataBase();
        DataSet rs = db.RunProcReturn("select * from tb_comment where id=" + commentId, "tb_comment");
        if (rs.Tables[0].Rows.Count > 0)
        {
            CommentEntity ce = new CommentEntity();
            ce.Id = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
            ce.CommetTitle = rs.Tables[0].Rows[0]["commenttitle"].ToString();
            ce.ConText = rs.Tables[0].Rows[0]["context"].ToString();
            ce.Agree = int.Parse(rs.Tables[0].Rows[0]["agree"].ToString());
            ce.DisAgree = int.Parse(rs.Tables[0].Rows[0]["disagree"].ToString());
            ce.uid = int.Parse(rs.Tables[0].Rows[0]["uid"].ToString());
            ce.nid = int.Parse(rs.Tables[0].Rows[0]["nid"].ToString());
            ce.UpTime = DateTime.Parse(rs.Tables[0].Rows[0]["uptime"].ToString());

            return ce;
        }
        return null;
    }
开发者ID:gqb101112,项目名称:ZCoder,代码行数:21,代码来源:CommentOperation.cs

示例7: GetNote

 public static NoteEntity GetNote(int noteId)
 {
     /*获取工程信息*/
     DataBase db = new DataBase();
     DataSet rs = db.RunProcReturn("select * from tb_note where id=" + noteId, "tb_note");
     if (rs.Tables[0].Rows.Count > 0)
     {
         NoteEntity ne = new NoteEntity();
         ne.NoteName = rs.Tables[0].Rows[0]["noteName"].ToString();
         ne.Uid = int.Parse(rs.Tables[0].Rows[0]["uid"].ToString());
         ne.Cid = int.Parse(rs.Tables[0].Rows[0]["cid"].ToString());
         ne.UpTime = DateTime.Parse(rs.Tables[0].Rows[0]["upTime"].ToString());
         ne.Id = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
         ne.StartLine = int.Parse(rs.Tables[0].Rows[0]["startLine"].ToString());
         ne.EndLine = int.Parse(rs.Tables[0].Rows[0]["endLine"].ToString());
         ne.Agree = int.Parse(rs.Tables[0].Rows[0]["agree"].ToString());
         ne.Disagree = int.Parse(rs.Tables[0].Rows[0]["disagree"].ToString());
         ne.Context = rs.Tables[0].Rows[0]["Context"].ToString();
         return ne;
     }
     return null;
 }
开发者ID:gqb101112,项目名称:ZCoder,代码行数:22,代码来源:NoteOperation.cs

示例8: Login

 /// <summary>
 /// 登陆
 /// </summary>
 /// <param name="Session">Session</param>
 /// <param name="userName">用户名</param>
 /// <param name="password">密码</param>
 /// <returns>成功为true,失败为false</returns>
 public static bool Login(System.Web.SessionState.HttpSessionState Session, string userName, string password)
 {
     if (userName == "" || password == "")
     {
         return false;
     }
     DataBase db = new DataBase(); /*实例化一个数据库。*/
     String str = Encrypt.encrypt(password);
     DataSet result = db.RunProcReturn("select * from tb_user where [email protected] and [email protected]", new SqlParameter[] {
     db.MakeInParam("username",System.Data.SqlDbType.VarChar,20,userName),
     db.MakeInParam("password",System.Data.SqlDbType.VarChar,200,str)
     }, "tb_user");     /*查询数据库中与输入的用户名密码相同的集。*/
     if (result.Tables[0].Rows.Count != 0)    /*  如数据库中有用户名密码与输入的用户名密码相同,则将username和password、uid放入session中。*/
     {
         Session.Add("username", userName);
         Session.Add("password", password);
         Session.Add("uid", result.Tables[0].Rows[0]["id"].ToString());
         Session.Add("isadmin", result.Tables[0].Rows[0]["isadmin"]);
         Session.Remove("loginerror");
         return true;
     }
     else
     {
         Session.Add("loginerror", true);
         return false;
     }
 }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:34,代码来源:UserOperation.cs

示例9: GetUser

 /// <summary>
 /// 获取用户信息
 /// </summary>
 /// <param name="userId">用户ID</param>
 /// <returns>返回UserEntity对象,可以读取用户信息</returns>
 public static UserEntity GetUser(int userId)
 {
     DataBase db = new DataBase();
     DataSet rs = db.RunProcReturn("select * from tb_user where id=" + userId, "tb_user");
     if (rs.Tables[0].Rows.Count > 0)
     {
         UserEntity ue = new UserEntity();
         ue.UserName = rs.Tables[0].Rows[0]["userName"].ToString();
         ue.Password = rs.Tables[0].Rows[0]["password"].ToString();
         ue.Qq = rs.Tables[0].Rows[0]["qq"].ToString();
         ue.RegTime = DateTime.Parse(rs.Tables[0].Rows[0]["regtime"].ToString());
         ue.Sex = bool.Parse(rs.Tables[0].Rows[0]["sex"].ToString());
         ue.Isadmin = bool.Parse(rs.Tables[0].Rows[0]["isadmin"].ToString());
         ue.Id = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
         ue.Email = rs.Tables[0].Rows[0]["email"].ToString();
         return ue;
     }
     return null;
 }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:24,代码来源:UserOperation.cs

示例10: GetNotesBySartLine

 /// <summary>
 /// 利用起始行获取注释信息
 /// </summary>
 /// <param name="startline">注释的起始行</param>
 /// <param name="cid">注释所属源码ID</param>
 /// <returns>返回注释</returns>
 public static List<NoteEntity> GetNotesBySartLine(int startline, int cid)
 {
     DataBase db = new DataBase();
     DataSet rs = db.RunProcReturn("select * from tb_note where startline=" + startline.ToString() + " and cid=" + cid.ToString(), "tb_note");
     List<NoteEntity> notes = new List<NoteEntity>();
     for (int i = 0; i < rs.Tables[0].Rows.Count; i++)
     {
         NoteEntity ne = new NoteEntity();
         ne.NoteName = rs.Tables[0].Rows[i]["noteName"].ToString();
         ne.Uid = int.Parse(rs.Tables[0].Rows[i]["uid"].ToString());
         ne.Cid = int.Parse(rs.Tables[0].Rows[i]["cid"].ToString());
         ne.UpTime = DateTime.Parse(rs.Tables[0].Rows[i]["upTime"].ToString());
         ne.Id = int.Parse(rs.Tables[0].Rows[i]["id"].ToString());
         ne.StartLine = int.Parse(rs.Tables[0].Rows[i]["startLine"].ToString());
         ne.EndLine = int.Parse(rs.Tables[0].Rows[i]["endLine"].ToString());
         ne.Agree = int.Parse(rs.Tables[0].Rows[i]["agree"].ToString());
         ne.Disagree = int.Parse(rs.Tables[0].Rows[i]["disagree"].ToString());
         ne.Context = rs.Tables[0].Rows[i]["Context"].ToString();
         ne.User = UserOperation.GetUser(ne.Uid);
         ne.Recommend = int.Parse(rs.Tables[0].Rows[i]["recommend"].ToString());
         notes.Add(ne);
     }
     return notes;
 }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:30,代码来源:NoteOperation.cs

示例11: GetCommentsByNid

 /// <summary>
 /// 利用Nid获取评论信息
 /// </summary>
 /// <param name="nid"></param>
 /// <returns></returns>
 public static List<CommentEntity> GetCommentsByNid(int nid)
 {
     DataBase db = new DataBase();
     DataSet rs = db.RunProcReturn("select * from tb_comment where nid=" + nid.ToString(), "tb_comment");
     List<CommentEntity> comments = new List<CommentEntity>();
     for (int i = 0; i < rs.Tables[0].Rows.Count; i++)
     {
         CommentEntity ce = new CommentEntity();
         ce.CommentTitle = rs.Tables[0].Rows[i]["commentTitle"].ToString();
         ce.UpTime = DateTime.Parse(rs.Tables[0].Rows[i]["upTime"].ToString());
         ce.Id = int.Parse(rs.Tables[0].Rows[i]["id"].ToString());
         ce.Agree = int.Parse(rs.Tables[0].Rows[i]["agree"].ToString());
         ce.DisAgree = int.Parse(rs.Tables[0].Rows[i]["disagree"].ToString());
         ce.ConText = rs.Tables[0].Rows[i]["Context"].ToString();
         ce.uid = int.Parse(rs.Tables[0].Rows[i]["uid"].ToString());
         ce.User = UserOperation.GetUser(ce.uid);
         comments.Add(ce);
     }
     return comments;
 }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:25,代码来源:CommentOperation.cs


注:本文中的DataBase.RunProcReturn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。