本文整理汇总了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")
//.........这里部分代码省略.........