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


C# DataBase类代码示例

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


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

示例1: DelAnnouncement

 public static void DelAnnouncement(String id)
 {
     /*删除公告*/
     DataBase db = new DataBase();
     string sql = "delete from dbo.tb_announcement where id=" + id + "";
     db.ExCommandNoBack(sql);
 }
开发者ID:gqb101112,项目名称:ZCoder,代码行数:7,代码来源:AnnouncementOperation.cs

示例2: DelProject

 public static void DelProject(String id)
 {
     /*删除工程*/
     DataBase db = new DataBase();
     string sql = "delete from dbo.tb_project where id=" + id + "";
     db.ExCommandNoBack(sql);
 }
开发者ID:gqb101112,项目名称:ZCoder,代码行数:7,代码来源:ProjectOperation.cs

示例3: loadVideos

    protected void loadVideos()
    {
        DataBase db = new DataBase();
        SqlConnection conn = db.Connection();
        SqlCommand cmd = db.GetCommand(conn, "dbo.GetVideos");

        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        try
        {
            conn.Open();
            da.Fill(ds, "Videos");
        }
        catch (Exception err)
        {
            lblError.Text = err.Message;
        }
        finally
        {
            conn.Close();
            conn.Dispose();
        }

        if (ds.Tables["Videos"].Rows.Count == 0)
        {
            lblError.Text = "Нема внесено видеа во базата!";
            return;
        }

        ViewState["dsVideos"] = ds;
        gvVideos.DataSource = ds.Tables["Videos"];
        gvVideos.DataBind();
    }
开发者ID:sdsmpehcevo,项目名称:sdsmpehcevo,代码行数:33,代码来源:Video.aspx.cs

示例4: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int id = int.Parse(Request.QueryString["id"].ToString());
            ProjectEntity pe = ProjectOperation.GetProject(int.Parse(Request.QueryString["id"].ToString()));

            if (pe != null)
            {
                DataBase db = new DataBase();
                DataSet sql = db.ExCommand(string.Format("SELECT tb_project.tid, tb_project.uid, tb_user.userName, "
                + "tb_project.description, tb_project.upTime,  "
                + "tb_project.projectName, tb_type.typeName, tb_project.id FROM tb_project INNER "
                + "JOIN tb_type ON tb_project.tid = tb_type.id INNER JOIN tb_user ON tb_project.uid = tb_user.id  WHERE (tb_project.id ={0} ) ", id));
                string User = sql.Tables[0].Rows[0]["userName"].ToString();
                string Type = sql.Tables[0].Rows[0]["typeName"].ToString();
                //在表单中显示数据
                lb_ProjectName.Text = pe.ProjectName;
                lb_Id.Text = pe.Id.ToString();
                lb_description.Text = pe.Description;
                lb_User.Text = User;
                lb_UpTime.Text = pe.UpTime.ToString();
                lb_Type.Text = Type;
            }
        }
    }
开发者ID:gqb101112,项目名称:ZCoder,代码行数:26,代码来源:DelProject.aspx.cs

示例5: Page_Load

    /// <summary>
    /// Page_Load
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //判断是否存在该id的公告
            int id = int.Parse(Request.QueryString["id"].ToString());
            AnnouncementEntity ae = AnnouncementOperation.GetAM(int.Parse(Request.QueryString["id"].ToString()));
            if (ae == null)
            {
                SmallScript.MessageBox(Page, "不存在该公告!点击返回!");
                SmallScript.GoBack(Page);
                return;
            }
            else
            {
                //在表单中显示数据
                DataBase db = new DataBase();
                DataSet sql = db.ExCommand(string.Format("SELECT tb_announcement.id, tb_announcement.uid, tb_announcement.amtitle, tb_announcement.essay, tb_announcement.uptime, tb_user.userName FROM  tb_announcement INNER JOIN  tb_user ON tb_announcement.uid = tb_user.id  WHERE (tb_announcement.id ={0} )", id));
                string User = sql.Tables[0].Rows[0]["userName"].ToString();
                lb_ID.Text = ae.Id.ToString();
                tb_amtitle.Text = ae.AmTitle;
                lb_User.Text = User;
                lb_essay.Text = ae.Essay;
                lb_UpTime.Text =ae.Time.ToString();

            }
        }
    }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:33,代码来源:EditAnnouncement.aspx.cs

示例6: imgBtnSave_Click

    //添加考试科目事件
    protected void imgBtnSave_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            Course course = new Course();               //创建考试科目对象
            //start:胡媛媛修改,去掉考试科目输入框两边的空格,加trim(),2010-4-29
            course.Name = txtName.Text.Trim();                 //设置考试科目对象属性

            //程军添加,添加考试科目,名称不能相同。2010-4-25
            DataBase db = new DataBase();
            string mySql = "select * from Course where Name ='" + txtName.Text.Trim() + "'";
            //end:胡媛媛修改,去掉考试科目输入框两边的空格,加trim(),2010-4-29
            if (db.GetRecord(mySql))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('课程章节重复!')</script>");
                this.txtName.Focus();
            }
            else
            {
               if (course.InsertByProc())                  //调用添加考试科目方法添加考试科目
              {
                  lblMessage.Text = "成功添加该章节科目!";
              }
              else
              {
                  lblMessage.Text = "添加该章节失败!";
              }
            }

            //程军添加,添加考试科目,名称不能相同。2010-4-25
        }
    }
开发者ID:dalinhuang,项目名称:my-project-step,代码行数:33,代码来源:admin_CourseAdd.aspx.cs

示例7: createAidsBrandList

    public string[] createAidsBrandList(CreateAidsBrand structValue)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "";
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "INSERT INTO AidsBrandTable (Category, Brand, CreateFileBy, CreateFileDate, UpFileBy , UpFileDate) " +
                    "VALUES(@Category, @Brand, @CreateFileBy, getDate(), @UpFileBy, getDate() )";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@Category", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(structValue.brandType);
                cmd.Parameters.Add("@Brand", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(structValue.brandName);
                cmd.Parameters.Add("@CreateFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message;
            }

        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:32,代码来源:ManageDataBase.cs

示例8: 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

示例9: 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

示例10: submit_Click

 /// <summary>
 /// 添加评论确定按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void submit_Click(object sender, EventArgs e)
 {
     DataBase db = new DataBase();
     CommentEntity ce = new CommentEntity();
     ce.Agree = 0;
     ce.nid = int.Parse(Request.QueryString["nid"].ToString());
     ce.DisAgree = 0;
     ce.CommentTitle = "";
     ce.ConText = tb_comment.Text;
     ce.uid = int.Parse(Session["uid"].ToString());
     ce.UpTime = DateTime.Now;
     if (ce.ConText == "")
     {
         Response.Write("请填写评论内容!");
         return;
     }
     if (CommentOperation.AddComment(ce))
     {
         Response.Redirect("LoadComment.aspx?nid=" + ce.nid );
         return;
     }
     else
     {
         Response.Write("添加评论失败");
     }
 }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:31,代码来源:comment.aspx.cs

示例11: FloodServ

                    public FloodServ(ServicesDaemon Base)
                        : base(Base)
                    {
                        FloodDB = new DataBase();

                        AddRequired("Help.dll");
                    }
开发者ID:Mediator,项目名称:Blacklight-IRC-Services,代码行数:7,代码来源:Module.cs

示例12: TreeNodeFile

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="f">database file object</param>
        public TreeNodeFile(DataBase.File f, TreeViewCatalog tvc)
            : base(f.Name, f, false, false, "GenericFile", f.Size, f.Date, true, false, false, false, false)
        {
            this.file = f;

            if (f.Attributes == 1)
            {
                this.ImageIndex = TreeImages.Folder;
                this.SelectedImageIndex = TreeImages.FolderOpen;
                this.typeName = "Folder";
                this.size = -1;
            }
            else
            {
                int pos = f.Name.LastIndexOf(".");

                string ext = "";

                if (pos >= 0)
                {
                    ext = f.Name.Substring(pos);
                }

                this.ImageIndex = tvc.FileIcons.GetFileIconId(ext);
                this.SelectedImageIndex = this.ImageIndex;
                this.typeName = "File";
            }
        }
开发者ID:drme,项目名称:disks-db,代码行数:32,代码来源:TreeNodeFile.cs

示例13: MemoryStream

 /* public static Toon LoadDataBlob(byte[] p) {
     return Serializer.DeserializeWithLengthPrefix<Toon>(new MemoryStream(p), PrefixStyle.Base128);
 }*/
 internal static Toon LoadDataBlob(DataBase.AccountDBDataSet.charactersRow row)
 {
     Toon t = Serializer.DeserializeWithLengthPrefix<Toon>(new MemoryStream(row.serialized_data), PrefixStyle.Base128);
     t.Serial = row.toonid;
     t.Name = row.name;
     return t;
 }
开发者ID:jannavarro,项目名称:prototypes,代码行数:10,代码来源:ServerToon.cs

示例14: EditAnnouncement

 public static void EditAnnouncement(int ID,String amtitle, String essay)
 {
     /*更新公告*/
     DataBase db = new DataBase();
     String sql = "UPDATE tb_announcement SET amtitle='" + amtitle + "',essay='" + essay + "' where id=" + ID.ToString();
     db.ExCommandNoBack(sql);
 }
开发者ID:gqb101112,项目名称:ZCoder,代码行数:7,代码来源:AnnouncementOperation.cs

示例15: GridViewVillages_SelectedIndexChanging

    protected void GridViewVillages_SelectedIndexChanging(object sender,
        GridViewSelectEventArgs e)
    {
        GridViewRow row = GridViewVillages.Rows[e.NewSelectedIndex];
        int villageId = Misc.String2Number(row.Cells[0].Text.Trim());
        PanelStats.Visible = true;
        TotalStats.Visible = true;
        string srcTable = "Goods";
        DataBase dataBase = new DataBase();
        DataSet dataSet = dataBase.GetGoods(srcTable, villageId);
        DataRow dataRow = dataSet.Tables[srcTable].Rows[0];
        string inputWood = dataRow.ItemArray[0].ToString();
        string inputClay = dataRow.ItemArray[1].ToString();
        string inputIron = dataRow.ItemArray[2].ToString();
        string inputCrop = dataRow.ItemArray[3].ToString();
        string inputVillageName = dataRow.ItemArray[4].ToString();
        LabelGoodsWood.Text = inputWood;
        LabelGoodsClay.Text = inputClay;
        LabelGoodsIron.Text = inputIron;
        LabelGoodsCrop.Text = inputCrop;
        int wood = Misc.String2Number(inputWood);
        int clay = Misc.String2Number(inputClay);
        int iron = Misc.String2Number(inputIron);
        int crop = Misc.String2Number(inputIron);
        int total = wood + clay + iron + crop;
        LabelGoodsTotal.Text = total.ToString();
        LabelVillageName.Text = inputVillageName;

        srcTable = "Reports";
        dataBase = new DataBase();
        dataSet = dataBase.GetLast5Reports(srcTable, villageId);
        RepeaterReports.DataSource = dataSet;
        RepeaterReports.DataMember = srcTable;
        RepeaterReports.DataBind();
    }
开发者ID:trippleflux,项目名称:jezatools,代码行数:35,代码来源:Default.aspx.cs


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