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


C# Db.ReturnDT方法代码示例

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


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

示例1: RadGrid1_ItemCommand1

    protected void RadGrid1_ItemCommand1(object sender, GridCommandEventArgs e)
    {
       
    

        if (e.CommandName == "displaycomments")
        {
            comment.Visible = true;
            GridDataItem dataItem = (GridDataItem)e.Item;
            Label k = (Label)dataItem.FindControl("itemid");
            int itemid = int.Parse(k.Text);

            Db dbClass = new Db();
            DataTable dt = new DataTable();
            string getc = @"SELECT     [User].Name, [User].ID, Comments.ID AS CID, Comments.Comment, Comments.ItemID, Comments.UID, Propic.Image, Propic.[Current]
FROM         [User] INNER JOIN
                      Comments ON [User].ID = Comments.UID INNER JOIN
                      Propic ON Comments.UID = Propic.UID
WHERE     (Comments.ItemID = "[email protected]") AND (Propic.[Current] = 1)
ORDER BY CID";
               dt = dbClass.ReturnDT(getc);
            RadGrid2.Columns.FindByUniqueName("loadit").HeaderText = "Comments";
            if (dt.Rows.Count == 0)
            {
                
                lblstatus.Visible = true;
                lblstatus.Text = "No Comments";
                RadGrid2.Columns.FindByUniqueName("loadit").FooterText = k.Text;
                vaibhav.Visible = false;
              


            }
            else
            {
                lblstatus.Visible = false;
                RadGrid2.Columns.FindByUniqueName("loadit").FooterText = k.Text;
                RadGrid2.DataSource = dt;
                RadGrid2.DataBind();
                vaibhav.Visible = true;
                
            }
            
        }
        else if (e.CommandName == "phew")
        {
            GridDataItem dataItem = (GridDataItem)e.Item;
            Label k = (Label)dataItem.FindControl("itemid");
            int itemid = int.Parse(k.Text);
            comment.Visible = false;
            int z = int.Parse(Session["UserID"].ToString());
            string iphew = "INSERT INTO Phew (UID , NID)VALUES (" + z + "," + itemid + ")";
            dbClass.DataBase(iphew);

            LinkButton lk = (LinkButton)dataItem.FindControl("phew");

            //How Much..
            DataTable dt = new DataTable();
            string getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + "";
            dt = dbClass.ReturnDT(getcvalue);
            lk.Text = "Unphew(" + dt.Rows.Count.ToString() + ")";
            lk.CommandName = "unphew";


            
            
                
                
              
                    
                
                
            


        }
        else if (e.CommandName == "unphew")
        { 
      // DELETE FROM Persons
//WHERE LastName='Tjessem' AND FirstName='Jakob'
            GridDataItem dataItem = (GridDataItem)e.Item;
            Label k = (Label)dataItem.FindControl("itemid");
            int itemid = int.Parse(k.Text);
            int X = int.Parse(Session["UserId"].ToString());
            string unphewup = "DELETE FROM Phew WHERE NID = "+itemid+" AND UID = "+X+"";
            dbClass.DataBase(unphewup);

            LinkButton lk = (LinkButton)dataItem.FindControl("phew");
            //How Much
            DataTable dt = new DataTable();
            string getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + "";
            dt = dbClass.ReturnDT(getcvalue);
            lk.Text = "Phew It!(" + dt.Rows.Count.ToString() + ")";
            lk.CommandName = "phew";



        
        }
        else if (e.CommandName == "like")
//.........这里部分代码省略.........
开发者ID:vaibhavgeek,项目名称:friendyoke,代码行数:101,代码来源:nfeed.ascx.cs


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