本文整理汇总了C#中SQLHelper.Get_DataTable方法的典型用法代码示例。如果您正苦于以下问题:C# SQLHelper.Get_DataTable方法的具体用法?C# SQLHelper.Get_DataTable怎么用?C# SQLHelper.Get_DataTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLHelper
的用法示例。
在下文中一共展示了SQLHelper.Get_DataTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnRun_Click
protected void btnRun_Click(object sender, EventArgs e)
{
string sql = tbxSql.Text.Trim().ToUpper();
SQLHelper db = new SQLHelper();
db.sql = sql;
if (sql.Contains("SELECT "))
{
DataTable dt = db.Get_DataTable();
gv.DataSource = dt;
gv.DataBind();
lblMsg.Text = "执行完成,查询结果如下:";
}
else
{
string result = db.ExecSql();
if (result == "1")
{
lblMsg.Text = "执行完成";
}
else
{
lblMsg.Text = "执行失败," + result;
}
}
}
示例2: bindFunctionList
protected void bindFunctionList()
{
functionList.Items.Clear();
//for (int i = 1; i <= 35; i++)
//{
// ListItem li = new ListItem();
// string img = "0" + i.ToString() + ".jpg";
// int len = img.Length;
// img = img.Substring(len - 6, 6);
// li.Value = img;
// li.Text = "<img src='../images/function_icon/" + img + "' />";
// functionList.Items.Add(li);
//}
SQLHelper db = new SQLHelper();
db.sql = "SELECT NewsId,Title,Description,pic FROM " + com.tablePrefix + "News WHERE lbid=64";
DataTable dt = db.Get_DataTable();
functionList.DataSource = dt;
foreach (DataRow dr in dt.Rows)
{
ListItem li = new ListItem();
li.Value = dr["NewsId"].ToString();
li.Text = "<img src='" + dr["pic"].ToString() + "' title='" + dr["Description"].ToString() + "' />";
functionList.Items.Add(li);
}
}
示例3: AdminInfo
public static DataTable AdminInfo(int id)
{
string sql = "SELECT * FROM " + com.tablePrefix + "Admin WHERE id=" + id.ToString() + "";
SQLHelper db = new SQLHelper();
db.sql = sql;
return db.Get_DataTable();
}
示例4: bindProPlb
protected void bindProPlb()
{
SQLHelper db = new SQLHelper();
db.sql = "SELECT lbid,lbname FROM " + com.tablePrefix + "lb WHERE parentid=4 Order By OrderId";
DataTable dt = db.Get_DataTable();
rptProLbParent.DataSource = dt;
rptProLbParent.DataBind();
}
示例5: bindProvince
protected void bindProvince()
{
SQLHelper db = new SQLHelper();
db.sql = "SELECT id,name FROM " + com.tablePrefix + "Province ORDER BY OrderID";
DataTable dt = db.Get_DataTable();
ddlProvince.DataSource = dt;
ddlProvince.DataValueField = "id";
ddlProvince.DataTextField = "name";
ddlProvince.DataBind();
}
示例6: bindLbList
protected void bindLbList()
{
pid = hPid.Value;
SQLHelper db = new SQLHelper();
db.sql = "SELECT lbid,lbname FROM " + com.tablePrefix + "lb WHERE parentid=" + pid + " Order by orderid";
DataTable dt = db.Get_DataTable();
lbList.DataSource = dt.DefaultView;
lbList.DataTextField = "lbname";
lbList.DataValueField = "lbid";
lbList.DataBind();
}
示例7: bindGv
public void bindGv()
{
lbid = hlbid.Value;
string sql = @"SELECT * FROM " + com.tablePrefix + "jiameng ORDER BY AddTime DESC";
SQLHelper db = new SQLHelper();
db.sql = sql;
DataTable dt = db.Get_DataTable();
GV.DataSource = dt.DefaultView;
GV.DataBind();
}
示例8: bindDDlLbid
protected void bindDDlLbid()
{
string sql = "SELECT lbid,lbname FROM " + com.tablePrefix + "lb WHERE parentid=1";
SQLHelper db = new SQLHelper();
db.sql = sql;
DataTable dt = db.Get_DataTable();
ddlLbid.DataSource = dt;
ddlLbid.DataTextField = "lbname";
ddlLbid.DataValueField = "lbid";
ddlLbid.DataBind();
}
示例9: emailExists
public bool emailExists(string email)
{
SQLHelper db = new SQLHelper();
db.sql = "SELECT * FROM " + com.tablePrefix + "Members WHERE email='" + email + "'";
DataTable dt = db.Get_DataTable();
if (dt.Rows.Count > 0)
{
return true;
}
else
{
return false;
}
}
示例10: bindGv
public void bindGv()
{
lbid = hlbid.Value;
string sql = @"SELECT *
FROM "[email protected]"News
WHERE lbid=" + lbid;
sql += " ORDER BY isTop DESC,IsIndex DESC,AddTime DESC";
SQLHelper db = new SQLHelper();
db.sql = sql;
DataTable dt = db.Get_DataTable();
GV.DataSource = dt.DefaultView;
GV.DataBind();
}
示例11: exists
public bool exists(string uname)
{
SQLHelper db = new SQLHelper();
db.sql = "SELECT * FROM " + com.tablePrefix + "Members WHERE username='" + uname + "'";
DataTable dt = db.Get_DataTable();
if (dt.Rows.Count > 0)
{
return true;
}
else
{
return false;
}
}
示例12: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
string pwd = txtPwd.Text;
string newPwd = txtNewPwd.Text;
string newPwd2 = txtNewPwd2.Text;
if (pwd.Length == 0)
{
alert.Show(Page, "请填写原密码");
return;
}
if (newPwd.Length == 0)
{
alert.Show(Page, "请填写新密码");
return;
}
if (newPwd != newPwd2)
{
alert.Show(Page, "新密码与确认新密码不一致");
return;
}
string memberName = Session["AdminName"].ToString();
SQLHelper db = new SQLHelper();
db.sql = "SELECT pwd FROM " + com.tablePrefix + "admin WHERE username='" + memberName + "'";
DataTable dt = db.Get_DataTable();
pwd = com.MD5(pwd, 1);
newPwd = com.MD5(newPwd, 1);
if (dt.Rows.Count > 0)
{
if (pwd != dt.Rows[0]["pwd"].ToString())
{
alert.Show(Page, "原密码错误");
return;
}
else
{
db.sql = "UPDATE admin SET Pwd='" + newPwd + "' WHERE username='" + memberName + "'";
db.ExecSql();
alert.Show(Page,"修改成功");
}
}
else
{
Response.Redirect("Login.aspx");
}
}
示例13: bindGv
public void bindGv()
{
pid = hPid.Value;
string sql = @"SELECT b.lbname,c.lbid AS Pid,c.lbname AS Pname, a.*
FROM "[email protected]"News a
INNER JOIN "[email protected]"lb b ON a.lbid=b.lbid
INNER JOIN "[email protected]"lb c ON b.parentid=c.lbid
WHERE c.lbid =" + pid;
sql += " ORDER BY a.isTop DESC,a.IsIndex DESC,a.AddTime DESC";
SQLHelper db = new SQLHelper();
db.sql = sql;
DataTable dt = db.Get_DataTable();
GV.DataSource = dt.DefaultView;
GV.DataBind();
}
示例14: setIsIndex
public string setIsIndex(string newsid)
{
string re = "";
string sql = "SELECT isNull(IsIndex,0) as IsIndex,lbid FROM " + com.tablePrefix + "News WHERE newsid=" + newsid;
SQLHelper db = new SQLHelper();
db.sql = sql;
DataTable dt = db.Get_DataTable();
if (dt.Rows.Count > 0)
{
if (dt.Rows[0][0].ToString() == "0")
re = "<a href='Prod.aspx?act=IsIndex&value=1&pid=" + pid + "&id=" + newsid + "' style='color:green;'>放到首页</a>";
else
re = "<a href='Prod.aspx?act=IsIndex&value=0&pid=" + pid + "&id=" + newsid + "' style='color:red;'>取消首页</a>";
}
return re;
}
示例15: setTopBtn
public string setTopBtn(string newsid)
{
string re = "";
string sql = "SELECT isNull(isTop,0) as isTop,lbid FROM " + com.tablePrefix + "News WHERE newsid=" + newsid;
SQLHelper db = new SQLHelper();
db.sql = sql;
DataTable dt = db.Get_DataTable();
if (dt.Rows.Count > 0)
{
string lbid = dt.Rows[0]["lbid"].ToString();
if (dt.Rows[0][0].ToString() == "0")
re = "<a href='News.aspx?act=top&lbid=" + lbid + "&id=" + newsid + "'>置顶</a>";
else
re = "已置顶";
}
return re;
}