private void AddSession(string sOpenId, string sFakeId, string sSession) { string sSql = string.Format("INSERT INTO `mpserver_session` (`session`, `time`, `user`, `other`) VALUES ('{0}', '{1}', '{2}', '{3}')", sSession, DateTime.Now, sOpenId, sFakeId); CDBAccess.MySqlDt(sSql); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace((string)Session["User"])) { Response.Redirect("Login.aspx"); return; } sUserID = Request["ID"]; if (string.IsNullOrWhiteSpace(sUserID)) { Response.Redirect("Login.aspx"); } else { string sSql = string.Format("SELECT * FROM `mpserver_mpweixin_login` WHERE `Id` = {0}", sUserID); DataTable dt = CDBAccess.MySqlDt(sSql); if (dt.Rows.Count <= 0) { Response.Redirect("Admin.aspx"); } else { TBMPUser.Text = dt.Rows[0]["MPUser"].ToString(); TBPass.Text = dt.Rows[0]["MPPass"].ToString(); TBYsid.Text = dt.Rows[0]["OriginalId"].ToString(); TBKfid.Text = dt.Rows[0]["ServerId"].ToString(); } } }
public void ProcessRequest(HttpContext context) { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { Ctop cp = new Ctop(); using (DataTable _dt = cn.ExecQuery("select top 10 * from T0004 ORDER BY C00016 DESC")) { Topdata[] TD = new Topdata[_dt.Rows.Count]; for (int i = 0; i < _dt.Rows.Count; i++) { Topdata tdrow = new Topdata(); tdrow.authors = Coding.ToUnicode(_dt.Rows[i]["C00025"].ToString()); tdrow.cover = _dt.Rows[i]["C00024"].ToString(); tdrow.id = _dt.Rows[i]["C00016"].ToString(); tdrow.last_update_chapter_name = Coding.ToUnicode(_dt.Rows[i]["C00022"].ToString()); tdrow.sum_chapters = "100"; tdrow.sum_source = "101"; tdrow.title = Coding.ToUnicode(_dt.Rows[i]["C00017"].ToString()); tdrow.types = Coding.ToUnicode(_dt.Rows[i]["C00019"].ToString()); TD[i] = tdrow; } cp.month = TD; cp.total = TD; cp.week = TD; } context.Response.Write(JsonSerialize.jSerialize(cp)); } }
/// <summary> /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网 /// </summary> /// public void ProcessRequest(HttpContext context) { comicsearchhots chots = new comicsearchhots(); chots.result = 1; chots.msg = "OK"; try { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { using (DataTable _dt = cn.ExecQuery(@"SELECT top 20 * FROM T0003 ORDER BY C00010 DESC")) { comicsearchhotData[] comDataList = new comicsearchhotData[_dt.Rows.Count]; for (int i = 0; i < _dt.Rows.Count; i++) { comicsearchhotData cData = new comicsearchhotData(); cData.id = _dt.Rows[i]["C00010"].ToString(); cData.name = Coding.ToUnicode(_dt.Rows[i]["C00011"].ToString()); comDataList[i] = cData; } chots.data = comDataList; } } } catch { } context.Response.ContentType = "text/plain"; context.Response.Write(JsonSerialize.jSerialize(chots)); }
void InitData() { int page = getRequestPage(); using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { int pageCount = 0; int RowsCount = 0; string sqlWhere = string.Empty; string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { sqlWhere = " where C00035 ='" + id + "'"; } using (_dt = exPagers.ExecutePager(page, Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PageSize"]), "cstr(C00034)", "*", "select * from T0006", sqlWhere, "C00034 desc", out pageCount, out RowsCount)) { PageInfo pi = new PageInfo(); pi.CurrPageIndex = Convert.ToInt32(page); //当前页码 b pi.PageCount = Convert.ToInt32(pageCount); //页数 pi.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PageSize"]); //每页显示 pi.RecordCount = RowsCount; //总数 this.PageInfoControl.i = pi; this.PageInfoControl.URL = "../pages/pic.aspx?value=" + page + "&"; this.PageInfoControl.initPage(); } } }
public void ProcessRequest(HttpContext context) { string comic_id = context.Request["comic_id"]; //漫画id string chap_id = context.Request["chap_id"]; //章节 using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { ChapInforMation chapIn = new ChapInforMation(); using (DataTable _dt = cn.ExecQuery(@"select * from T0005 where C00029=? and C00030=?" , new OleDbParameter[] { new OleDbParameter("@C00029", chap_id), new OleDbParameter("@C00030", comic_id) })) { if (_dt.Rows.Count > 0) { DataRow dr = _dt.Rows[0]; chapIn.chapter_name = Coding.ToUnicode(dr["C00031"].ToString()); chapIn.chapter_order = dr["C00032"].ToString(); chapIn.comic_id = dr["C00030"].ToString(); } } string h_id = chap_id; //上一张 using (DataTable _dt = cn.ExecQuery(@"select top 1 C00029 from T0005 where C00030=" + comic_id + " and C00029 < " + chap_id + " order by C00029 desc")) { if (_dt.Rows.Count > 0) { h_id = _dt.Rows[0]["C00029"].ToString(); chapIn.id = h_id; //根据话id 查找 using (DataTable _dts = cn.ExecQuery(@"Select * from T0006 WHERE C00035=? order by C00034 asc" , new OleDbParameter[] { new OleDbParameter("@C00035", h_id) })) { string[] pages = new string[_dts.Rows.Count]; for (int i = 0; i < _dts.Rows.Count; i++) { pages[i] = _dts.Rows[i]["C00036"].ToString(); } chapIn.page = pages; } } } context.Response.ContentType = "text/plain"; context.Response.Write(JsonSerialize.jSerialize(chapIn)); } }
protected void ButEdit_Click(object sender, EventArgs e) { string sSql = string.Format("UPDATE `mpserver_mpweixin_login` SET `MPUser`='{0}', `MPPass`='{1}', `OriginalId`='{2}', `MPKey`='{3}', `User`='{4}', `ServerId`='{5}' WHERE (`Id`='{6}')", TBMPUser.Text, TBPass.Text, TBYsid.Text, TBKfid.Text, sUserID); CDBAccess.MySqlDt(sSql); Response.Redirect("Admin.aspx"); }
/// <summary> /// ACCESS高效分页 /// </summary> /// <param name="pageIndex">当前页码</param> /// <param name="pageSize">分页容量</param> /// <param name="strKey">主键</param> /// <param name="showString">显示的字段</param> /// <param name="queryString">查询字符串,支持联合查询</param> /// <param name="whereString">查询条件,若有条件限制则必须以where 开头</param> /// <param name="orderString">排序规则</param> /// <param name="pageCount">传出参数:总页数统计</param> /// <param name="recordCount">传出参数:总记录统计</param> /// <returns>装载记录的DataTable</returns> public static DataTable ExecutePager(int pageIndex, int pageSize, string strKey, string showString, string queryString, string whereString, string orderString, out int pageCount, out int recordCount) { if (pageIndex < 1) { pageIndex = 1; } if (pageSize < 1) { pageSize = 10; } if (string.IsNullOrEmpty(showString)) { showString = "*"; } if (string.IsNullOrEmpty(orderString)) { orderString = strKey + " asc "; } using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { string myVw = string.Format(" ( {0} ) tempVw ", queryString); string sql111 = string.Format(" select count(*) as recordCount from {0} {1}", myVw, whereString); recordCount = Convert.ToInt32(cn.ExecScalar(sql111)); if ((recordCount % pageSize) > 0) { pageCount = recordCount / pageSize + 1; } else { pageCount = recordCount / pageSize; } string sql; if (pageIndex == 1)//第一页 { sql = string.Format("select top {0} {1} from {2} {3} order by {4} ", pageSize, showString, myVw, whereString, orderString); } else if (pageIndex > pageCount)//超出总页数 { sql = string.Format("select top {0} {1} from {2} {3} order by {4} ", pageSize, showString, myVw, "where 1=2", orderString); } else { int pageLowerBound = pageSize * pageIndex; int pageUpperBound = pageLowerBound - pageSize; string recordIDs = recordID(string.Format("select top {0} {1} from {2} {3} order by {4} ", pageLowerBound, strKey, myVw, whereString, orderString), pageUpperBound); sql = string.Format("select {0} from {1} where {2} in ({3}) order by {4} ", showString, myVw, strKey, recordIDs, orderString); } using (DataTable dt = cn.ExecQuery(sql)) { return(dt); } } }
protected void ButEdit_Click(object sender, EventArgs e) { string sMPKey = Guid.NewGuid().ToString().Substring(1, 5); string sAddUser = (string)Session["User"]; string sSql = string.Format("INSERT INTO `mpserver_mpweixin_login` (`MPUser`, `MPPass`, `OriginalId`, `MPKey`, `User`, `ServerId`) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')", TBMPUser.Text, TBPass.Text, TBYuanShiId.Text, sMPKey, sAddUser, TBKfid.Text); CDBAccess.MySqlDt(sSql); Response.Redirect("Admin.aspx"); }
/// <summary> /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网 /// </summary> /// public void ProcessRequest(HttpContext context) { CallBackJson json = new CallBackJson(); jsonClass jclass = new jsonClass(); jclass.Status = "Error"; jclass.Msg = "服务器异常"; try { string _id = context.Request.Form["id"]; //小分类id string _name = context.Request.Form["name"]; //小分类名称 string _type = context.Request.Form["type"]; //类型 0修改 1添加 if (string.IsNullOrEmpty(_name.Trim())) { throw new Exception("信息参数未空"); } using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { if (_type == "0") { cn.ExecSQL(@"UPDATE T0001 SET C00006=? WHERE C00004=?", new OleDbParameter[] { new OleDbParameter("@C00003", _name), new OleDbParameter("@C00001", _id) }); jclass.Msg = "恭喜你!修改分类成功"; } else { string systemid = cn.ExecScalar(@"select max(Val(C00004))+1 from T0001 where C00101 <> 6 ").ToString(); if (string.IsNullOrEmpty(systemid)) { systemid = "1"; } cn.ExecSQL(@"INSERT INTO T0001 (C00004,C00005,C00006,C00101) VALUES (?,?,?,?)", new OleDbParameter[] { new OleDbParameter("@C00004", systemid), new OleDbParameter("@C00005", ""), new OleDbParameter("@C00006", _name), new OleDbParameter("@C00101", _id) }); jclass.Msg = "恭喜你!添加分类成功"; } jclass.Status = "Success"; } } catch (Exception ex) { jclass.Msg = ex.Message; } context.Response.Write(json.Serializer(jclass)); }
internal static void AddEdit(HttpContext context) { string sSql = string.Format("DELETE FROM `Push_Messages` WHERE `OriginalId` = '{0}'", context.Request["OriginalId"]); CDBAccess.MySqlDt(sSql); string[] sData = new string[] { context.Request["j1"], context.Request["MsgText1"], context.Request["OriginalId"] }; sSql = string.Format("INSERT INTO `Push_Messages` (`type`, `text`, `OriginalId`) VALUES ('{0}', '{1}', '{2}')", sData); CDBAccess.MySqlDt(sSql); sData = new string[] { context.Request["j2"], context.Request["MsgText2"], context.Request["OriginalId"] }; sSql = string.Format("INSERT INTO `Push_Messages` (`type`, `text`, `OriginalId`) VALUES ('{0}', '{1}', '{2}')", sData); CDBAccess.MySqlDt(sSql); }
/// <summary> /// 写入Cookies /// </summary> private static void WriteCookies() { //删除同OriginalId的记录 string sSql = string.Format("DELETE FROM `mpserver_cookies` WHERE OriginalId = '{0}'", WeiXinMsgInfo.OriginalId); CDBAccess.MySqlDt(sSql); //插入新OriginalId记录 string sCookies = GetAllCookies(LoginInfo.LoginCookie); sSql = string.Format("INSERT INTO `mpserver_cookies` (`Cookies`, `Token`, `OriginalId`, `Time`) VALUES ('{0}', '{1}', '{2}', '{3}')", sCookies, LoginInfo.Token, WeiXinMsgInfo.OriginalId, LoginInfo.CreateDate); CDBAccess.MySqlDt(sSql); }
public bool ChecksOriginalId(string sOriginalId) { string sSql = string.Format("SELECT COUNT(1) FROM `mpserver_mpweixin_login` WHERE `OriginalId` = '{0}'", sOriginalId); DataTable dt = CDBAccess.MySqlDt(sSql); if (dt.Rows.Count < 0) { return(false); } else { return(Convert.ToInt16(dt.Rows[0][0]) > 0); } }
public static DataTable ShowSendUser(string sOriginalId) { string sSql = string.Format("SELECT `Id`,`OpenId`,`DateTime` FROM `push_logs` WHERE `DateTime` >= NOW() - INTERVAL 2 DAY AND `OriginalId` = '{0}' GROUP BY `OpenId`", sOriginalId); DataTable dt = CDBAccess.MySqlDt(sSql); if (dt.Rows.Count <= 0) { return(null); } else { return(dt); } }
public static DataTable ShowEdit(HttpContext context) { string sSql = string.Format("Select * From `Push_Messages` WHERE `OriginalId` = '{0}' LIMIT 0, 2", context.Request["OriginalId"]); DataTable dt = CDBAccess.MySqlDt(sSql); if (dt.Rows.Count <= 0) { return(null); } else { return(dt); } }
public static CPageDataCache CreatePageDataCache(string sKey, string SqlString, int Spacing) { CPageDataCache cpdc = new CPageDataCache(); cpdc.UpdateSpacing = Spacing; cpdc.SqlString = SqlString; //执行查询 string Connstr = System.Configuration.ConfigurationManager.AppSettings["DBConnStr"]; using (CDBAccess cn = new CDBAccess(Connstr)) { cpdc.dt = cn.ExecQuery(cpdc.SqlString); } cpdc.dt.TableName = "TBN_" + DateTime.Now.ToString("HH:mm:ss fffff"); cpdc.UpdateTime = DateTime.Now; return(cpdc); }
void InitData() { try { int page = getRequestPage(); using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { string classifyid = Request.QueryString["id"]; string sql = string.Empty; string sqlWhere = string.Empty; if (!string.IsNullOrEmpty(classifyid)) { sql = @"select * from T0002,T0003 where C00010=C00009 and cstr(C00008)='" + classifyid + "'"; } else { sql = @"select * from T0003"; } int pageCount = 0; int RowsCount = 0; string kw = Request.QueryString["kw"]; if (!string.IsNullOrEmpty(kw)) { sqlWhere = " where C00011 like '%" + kw + "%'"; Textserch.Text = kw; } using (_dt = exPagers.ExecutePager(page, Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PageSize"]), "cstr(C00010)", "*", sql, sqlWhere, "C00014 desc", out pageCount, out RowsCount)) { PageInfo pi = new PageInfo(); pi.CurrPageIndex = Convert.ToInt32(page); //当前页码 pi.PageCount = Convert.ToInt32(pageCount); //页数 pi.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PageSize"]); //每页显示 pi.RecordCount = RowsCount; //总数 this.PageInfoControl.i = pi; this.PageInfoControl.URL = "../pages/comic.aspx?value=" + page + "&kw=" + kw + "&id=" + classifyid + "&"; this.PageInfoControl.initPage(); } } } catch { Response.Redirect("comic.aspx"); } }
/*ERROR CODE: * -10011 MP帐号密码未设置 * -10001 系统错误 * 1绑定成功 * 0记录成功 */ public static string IsBindFakeId() { bool bGetFans = WeiXinTool.OpenIdToFans(WeiXinMsgInfo.OpenId); string[] aMPInfo = WeiXinTool.GetMPUserInfo(WeiXinMsgInfo.OriginalId); WeiXinBindInfo.MPUser = aMPInfo[0]; WeiXinBindInfo.MPPass = aMPInfo[1]; Weixin_Server.Bind.Helper.WeiXinLogin.ExecLogin(WeiXinBindInfo.MPUser, WeiXinBindInfo.MPPass); if (aMPInfo == null) { return("-10011"); } WeiXinBindInfo.BreakMsg = Guid.NewGuid().ToString().Substring(0, 5); //WeiXinBindInfo.BreakMsg = "cbe5c"; if (!bGetFans) { string sOutText = string.Format("您是首次使用本平台,将会为您自动注册,如果在5秒内收到绑定成功信息则代表注册成功!<a href=\"http:////Rmbz.Net\\{0}\"> </a>", WeiXinBindInfo.BreakMsg); //MPServer mp = new MPServer(); WritePage(sOutText, false); Thread.Sleep(2500); string[] aFakeId = Bind.MPBind.BindFakeId(WeiXinBindInfo.BreakMsg, WeiXinBindInfo.MPUser, WeiXinBindInfo.MPPass); if (aFakeId.Length == 2) { WeiXinFans.sFakeId = aFakeId[0]; string sSql = string.Format("INSERT INTO `mpserver_bridge` (`openid`, `fakeid`, `name`, `time`) VALUES ('{0}', '{1}', '{2}', '{3}')", WeiXinMsgInfo.OpenId, aFakeId[0], WeiXinTool.Base64Code(aFakeId[1]), DateTime.Now); CDBAccess.MySqlDt(sSql); Weixin_Server.Bind.Helper.SendMsg.SendMessageText(aFakeId[1] + " 绑定成功,现在您可以体验完整功能啦。", WeiXinFans.sFakeId); return("1"); } else { string sSql = string.Format("INSERT INTO `mpserver_bridge` (`openid`, `fakeid`, `name`, `time`) VALUES ('{0}', '{1}', '{2}', '{3}')", WeiXinMsgInfo.OpenId, 0, 0, DateTime.Now); CDBAccess.MySqlDt(sSql); return("-10001"); } } else { string sSql = string.Format("INSERT INTO `Push_logs` (`openid`, `text`, `do`, `datetime`, `OriginalId`) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')", WeiXinMsgInfo.OpenId, WeiXinMsgInfo.Text, WeiXinMsgInfo.Do, DateTime.Now, WeiXinMsgInfo.OriginalId); CDBAccess.MySqlDt(sSql); return("0"); } }
/// <summary> /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网 /// </summary> /// public void ProcessRequest(HttpContext context) { CallBackJson json = new CallBackJson(); Classify classify = new Classify(); classify.Status = "Error"; classify.Msg = "服务器异常"; try { string id = context.Request.Form["id"]; if (string.IsNullOrEmpty(id)) { throw new Exception("信息不完整"); } using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { using (DataTable _dt = cn.ExecQuery("select * from T0001 WHERE C00004=?", new OleDbParameter[] { new OleDbParameter("@id", id) })) { if (_dt.Rows.Count > 0) { classify.Status = "Success"; classify.classifyName = _dt.Rows[0]["C00006"].ToString(); classify.Msg = "获取信息成功"; } else { throw new Exception("未找到分类信息"); } } } } catch (Exception ex) { classify.Msg = ex.Message; } context.Response.Write(json.Serializer(classify)); }
/// <summary> /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网 /// </summary> /// public void ProcessRequest(HttpContext context) { string id = context.Request.Form["thisid"]; if (!string.IsNullOrEmpty(id)) { using (CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { cn.ExecSQL("delete from T0000 where C00001 = '" + id + "'"); cn.ExecSQL("delete from T0001 where C00101 = " + id + ""); context.Response.Write("0"); context.Response.End(); } } else { context.Response.Write("参数错误"); context.Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace((string)Session["User"])) { Response.Redirect("Login.aspx"); return; } string sUserId = Request["id"]; if (string.IsNullOrWhiteSpace(sUserId)) { Response.Redirect("Login.aspx"); } else { string sSql = string.Format("DELETE FROM `mpserver_mpweixin_login` WHERE (`Id`='{0}')", sUserId); CDBAccess.MySqlDt(sSql); Response.Redirect("Admin.aspx"); } }
void InitData() { int page = getRequestPage(); using (CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { int pageCount = 0; int RowsCount = 0; using (_dt = exPagers.ExecutePager(page, Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PageSize"]), "C00001", "*", "select * from T0000", "", "C00001 asc", out pageCount, out RowsCount)) { PageInfo pi = new PageInfo(); pi.CurrPageIndex = Convert.ToInt32(page); //当前页码 pi.PageCount = Convert.ToInt32(pageCount); //页数 pi.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PageSize"]); //每页显示 pi.RecordCount = RowsCount; //总数 this.PageInfoControl.i = pi; this.PageInfoControl.URL = "../pages/classify.aspx?value=" + page + "&"; this.PageInfoControl.initPage(); } } }
public void ProcessRequest(HttpContext context) { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { //获取大分类的信息 using (DataTable _dtBig = cn.ExecQuery(@"select * from T0000 order by C00001 asc")) { TreeListing[] tl = new TreeListing[_dtBig.Rows.Count]; for (int i = 0; i < _dtBig.Rows.Count; i++) { TreeListing tlb = new TreeListing(); tlb.id = _dtBig.Rows[i]["C00001"].ToString(); tlb.title = _dtBig.Rows[i]["C00003"].ToString(); tlb.icon = _dtBig.Rows[i]["C00002"].ToString(); using (DataTable _dtSmall = cn.ExecQuery(@"select * from T0001 where C00101=? order by C00004", new OleDbParameter[] { new OleDbParameter("@a", _dtBig.Rows[i]["C00001"].ToString()) })) { TreeListing[] tls = new TreeListing[_dtSmall.Rows.Count]; for (int j = 0; j < _dtSmall.Rows.Count; j++) { TreeListing tlsRow = new TreeListing(); tlsRow.id = _dtSmall.Rows[j]["C00004"].ToString(); tlsRow.icon = _dtSmall.Rows[j]["C00005"].ToString(); tlsRow.title = _dtSmall.Rows[j]["C00006"].ToString(); tls[j] = tlsRow; } tlb.subnodes = tls; } tl[i] = tlb; } //信息填充后 json 序列化返回 context.Response.Write(JsonSerialize.jSerialize(tl)); } } }
/// <summary> /// 分页使用 /// </summary> /// <param name="query"></param> /// <param name="passCount"></param> /// <returns></returns> private static string recordID(string query, int passCount) { string result = string.Empty; using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { using (DataTable _dt = cn.ExecQuery(query)) { foreach (DataRow dr in _dt.Rows) { if (passCount < 1) { result += ",'" + dr[0] + "'"; } passCount--; } } return(result.Substring(1)); } }
void UpdateDt() { try { lock (isUpdatting) { if (isUpdatting == "1") { return; } isUpdatting = "1"; } //在此执行查询 string Connstr = System.Configuration.ConfigurationManager.AppSettings["DBConnStr"]; DataTable dt2 = null; using (CDBAccess cn = new CDBAccess(Connstr)) { dt2 = cn.ExecQuery(SqlString); } dt2.TableName = "TBN_" + DateTime.Now.ToString("HH:mm:ss fffff"); DataTable dtTemp = this.dt; lock (this.dt) { this.UpdateTime = DateTime.Now; this.dt = dt2; } dtTemp.Dispose(); lock (isUpdatting) { isUpdatting = "0"; } } catch (Exception ex) { } }
private bool CheckSession(string sOpenId, string sSession) { string sSql = string.Format("SELECT * FROM `mpserver_session` WHERE `User` = '{0}' AND `session` = '{1}'", sOpenId, sSession); DataTable dt = CDBAccess.MySqlDt(sSql); if (dt.Rows.Count <= 0) { return(false); } else { DateTime dtTime = (DateTime)dt.Rows[0]["time"]; if ((DateTime.Now - dtTime).TotalSeconds <= 300) { return(true); } else { DelSession(sOpenId); return(true); } } }
protected void ButLogin_Click(object sender, EventArgs e) { string sUser = TBUser.Text; string sPass = TBPass.Text; if (string.IsNullOrWhiteSpace(sUser)) { Tips.Text = "用户名不能为空"; return; } if (string.IsNullOrWhiteSpace(sPass)) { Tips.Text = "用户名不能为空"; return; } string sSql = string.Format("SELECT * FROM `mpserver_server_user` WHERE `user`='{0}'", sUser); DataTable dt = CDBAccess.MySqlDt(sSql); if (dt.Rows.Count <= 0) { Tips.Text = "帐号或密码错误!"; return; } else { if (dt.Rows[0]["pass"].ToString() != sPass) { Tips.Text = "帐号或密码错误!"; return; } else { Session.Add("User", sUser); Response.Redirect("admin.aspx"); } } }
void BindData() { using (CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { dt01 = cn.ExecQuery("select * from T0000"); dttype = cn.ExecQuery("select * from T0001"); string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { //当前漫画对应的多个分类 using (DataTable dt3 = cn.ExecQuery("select * from T0003 where C00010 = " + id + "")) { thisdttypes = cn.ExecQuery("select * from T0002 where C00009 = " + id + ""); if (dt3.Rows.Count > 0) { TextBox1.Text = dt3.Rows[0]["C00011"].ToString(); } using (DataTable dt = cn.ExecQuery("select * from T0004 where C00016 = " + id + "")) { if (dt.Rows.Count > 0) { TextBox2.Text = dt.Rows[0]["C00018"].ToString(); TextBox4.Text = dt.Rows[0]["C00024"].ToString(); TextBox5.Text = dt.Rows[0]["C00025"].ToString(); TextBox6.Text = dt.Rows[0]["C00026"].ToString(); } } } } else { //当前漫画对应的多个分类 thisdttypes = cn.ExecQuery("select * from T0002 where C00009 = -1 "); } } }
public static DataTable FakeList(string sOriginalId) { string sSql = string.Format(@"SELECT `push_logs`.`OpenId`, `mpserver_bridge`.`fakeid` FROM `push_logs` LEFT JOIN `mpserver_bridge` ON `push_logs`.`OpenId` = `mpserver_bridge`.`openid` WHERE `DateTime` >= NOW() - INTERVAL 2 DAY AND `OriginalId` = '{0}' GROUP BY `push_logs`.`OpenId`" , sOriginalId); DataTable dt = CDBAccess.MySqlDt(sSql); if (dt.Rows.Count <= 0) { return(null); } else { return(dt); } }
void InitData() { int page = getRequestPage(); string id = Request.QueryString["id"]; if (string.IsNullOrEmpty(id)) { Response.Redirect("comic.aspx"); return; } using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { int pageCount = 0; int RowsCount = 0; string sqlWhere = " where cstr(C00030)='" + id + "'"; string kw = Request.QueryString["kw"]; if (!string.IsNullOrEmpty(kw)) { sqlWhere = " where cstr(C00030)='" + id + "' and C00031 like '%" + kw + "%'"; Textserch.Text = kw; } using (_dt = exPagers.ExecutePager(page, Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PageSize"]), "cstr(C00029)", "*", "select * from T0005 ", sqlWhere, "C00029 desc", out pageCount, out RowsCount)) { PageInfo pi = new PageInfo(); pi.CurrPageIndex = Convert.ToInt32(page); //当前页码 pi.PageCount = Convert.ToInt32(pageCount); //页数 pi.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PageSize"]); //每页显示 pi.RecordCount = RowsCount; //总数 this.PageInfoControl.i = pi; this.PageInfoControl.URL = "../pages/chap.aspx?value=" + page + "&"; this.PageInfoControl.initPage(); } } }