Accesshelper.cs
using System;
using System.Data;
using System.Data.OleDb;
using System.Collections;
using System.IO;
using System.Globalization;
using System.Configuration; namespace ArticleManage
{
public class DataAccess
{
定义#region 定义
protected OleDbCommand Comm;
protected OleDbDataAdapter Adap;
protected OleDbConnection Conn; //SQL连接
private string _connectString; //连接串
private string _commandString; //SQL命令
private Hashtable _dict, _result, _mapTable;
private DataSet _ds; //返回结果数据集
private DataRow _recordSet; //纪录集
private string _tableName; //表名
private int _recordCount; //纪录集的行数
private bool _eOF; //结果集是否为空,是否已经到了结尾
private string DB;
private string _deleteOP;
private string _path;
private StreamWriter SWCreate, SWApp;
private string _errorMessage;
private bool _writeLog;
#endregion 属性集#region 属性集
/**//// <summary>
/// 出错信息
/// </summary>
///
public string ErrorMessage
{
get { return this._errorMessage; }
set { this._errorMessage = value; }
} /**//**/
/**//// <summary>
/// 设置或者取得删除的操作者
/// </summary>
public string DeleteOP
{
get { return this._deleteOP; }
set { this._deleteOP = value; }
} /**//**/
/**//// <summary>
/// 取得是否溢出
/// </summary>
public bool EOF
{
get { return this._eOF; }
set { this._eOF = value; }
} /**//**/
/**//// <summary>
/// 取得执行语句后得出的纪录条数
/// </summary>
public int RecordCount
{
get { return this._recordCount; }
set { this._recordCount = value; }
} /**//**/
/**//// <summary>
/// 数据库中的表名
/// </summary>
public string TableName
{
get { return this._tableName; }
set { this._tableName = value; }
} /**//**/
/**//// <summary>
/// 返回的记录集
/// </summary>
public DataRow RecordSet
{
get { return this._recordSet; }
set { this._recordSet = value; }
} /**//**/
/**//// <summary>
/// 返回的数据集
/// </summary>
public DataSet DS
{
get { return this._ds; }
set { this._ds = value; }
} /**//**/
/**//// <summary>
/// 字段和控件的映射表
/// </summary>
public Hashtable MapTable
{
get { return this._mapTable; }
set { this._mapTable = value; }
} /**//**/
/**//// <summary>
/// 修改数据时,作为修改结果
/// </summary>
public Hashtable Result
{
get { return this._result; }
set { this._result = value; }
} /**//**/
/**//// <summary>
/// 保存数据用的字段和值对应的哈希表,修改数据时用作条件
/// </summary>
public Hashtable Dict
{
get { return this._dict; }
set { this._dict = value; }
} /**//**/
/**//// <summary>
/// 查询语句
/// </summary>
public string CommandString
{
get { return this._commandString; }
set { this._commandString = value; }
} /**//**/
/**//// <summary>
/// 连接串
/// </summary>
public string ConnectString
{
get { return this._connectString; }
set { this._connectString = value; }
} #endregion DataAccess的构造函数#region DataAccess的构造函数
/**//// <summary>
/// 空构造函数
/// <appSettings>
/// <add key="DBConn" value="provider=microsoft.jet.oledb.4.0;data source="/>
/// <add key="dbPath" value="~/App_Data/ArticleManage.mdb"/>
///</appSettings>
/// </summary>
public DataAccess()
{
ConnectString = System.Configuration.ConfigurationSettings.AppSettings["DBConn"]+System.Web.HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["dbPath"])+";";
Conn = new System.Data.OleDb.OleDbConnection(ConnectString);
if (System.Configuration.ConfigurationSettings.AppSettings["WriteLog"] == "true")
{
_writeLog = true;
}
else
{
_writeLog = false;
} } ~DataAccess()
{
} /**//**/
/**//// <summary>
/// DataAccess的构造函数
/// <appSettings>
/// <add key="DBConn" value="provider=microsoft.jet.oledb.4.0;data source="/>
/// <add key="DB1" value="~/App_Data/ArticleManage.mdb"/>
///</appSettings>
/// </summary>
/// <param name="DB1">要访问的数据库名,Web.config里设置的连接字符串对应的key</param>
/// <param name="TableName1">要访问的数据表名</param>
public DataAccess(string DB1, string TableName1)
{
this.ErrorMessage = "";
DB = DB1;
TableName = TableName1;
try
{
ConnectString = System.Configuration.ConfigurationSettings.AppSettings["DBConn"]+System.Web.HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["DB"])+";";
if (System.Configuration.ConfigurationSettings.AppSettings["WriteLog"] == "true")
{
_writeLog = true;
}
else
{
_writeLog = false;
}
Conn = new System.Data.OleDb.OleDbConnection(ConnectString);
Dict = new Hashtable();
Result = new Hashtable();
MapTable = new Hashtable();
DS = new DataSet(); // IS_Open = false;
_path = "C:\\WebDebug.log";
if (_writeLog)
{
if (!File.Exists(_path))
{
using (SWCreate = File.CreateText(_path))
{
SWCreate.WriteLine(" ");
SWCreate.Close();
}
}
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine(" ");
}
}
}
catch (Exception e)
{
this.ErrorMessage = e.ToString();
}
} /**//**/
/**//// <summary>
/// DataAccess的构造函数
/// </summary>
/// <param name="CST">数据库的连接字符串</param>
/// <param name="TableName1">要访问的数据表名</param>
/// <param name="flag">是否初始化</param>
public DataAccess(string CST, string TableName1, bool flag)
{
if (flag == true)
{
this.ErrorMessage = "";
TableName = TableName1;
try
{
if (System.Configuration.ConfigurationSettings.AppSettings["WriteLog"] == "true")
{
_writeLog = true;
}
else
{
_writeLog = false;
}
ConnectString = CST;
Conn = new System.Data.OleDb.OleDbConnection(ConnectString);
Dict = new Hashtable();
Result = new Hashtable();
MapTable = new Hashtable();
DS = new DataSet(); _path = "C:\\WebDebug.log";
if (_writeLog)
{
if (!File.Exists(_path))
{
using (SWCreate = File.CreateText(_path))
{
SWCreate.WriteLine(" ");
SWCreate.Close();
}
}
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine(" ");
}
}
}
catch (Exception e)
{
this.ErrorMessage = e.ToString();
}
}
}
#endregion ExecuteNonQuery#region ExecuteNonQuery
/**//// <summary>
/// 执行无返回结果的SQL
/// </summary>
/// <param name="strSQL"></param>
public void ExecuteNonQuery(string strSQL)
{
Comm = new OleDbCommand();
OleDbTransaction Trans;
Conn.Open();
Trans = Conn.BeginTransaction();
Comm.CommandText = strSQL;
Comm.Connection = Conn;
Comm.Transaction = Trans;
Comm.CommandTimeout = 60; try
{
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "] CommandString = " + strSQL);
SWApp.Close();
}
} Comm.ExecuteNonQuery();
Trans.Commit();
this.Conn.Close();
}
catch (Exception e)
{
Trans.Rollback();
this.Conn.Close();
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "] Error Message : " + e.ToString());
}
}
this.ErrorMessage = e.ToString();
throw new Exception(e.ToString());
}
} /**//// <summary>
/// 执行无返回结果的SQL
/// </summary>
/// <param name="param">参数集合</param>
/// <param name="strSQL"></param>
public void ExecuteNonQuery(string strSQL, ICollection param)
{
Comm = new OleDbCommand();
OleDbTransaction Trans;
Conn.Open();
Trans = Conn.BeginTransaction();
Comm.CommandText = strSQL;
Comm.Connection = Conn;
Comm.Transaction = Trans;
Comm.CommandTimeout = 60; try
{
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "] CommandString = " + strSQL);
SWApp.Close();
}
} if (param != null)
{
foreach (ParamInfo p in param)
{
IDbDataParameter pa = Comm.CreateParameter();
pa.ParameterName = p.Name;
pa.Value = p.Value; //处理大文本
if (pa is System.Data.OleDb.OleDbParameter && pa.Value != null && pa.Value.ToString().Length >= 4000)
{
System.Data.OleDb.OleDbParameter p1 = pa as System.Data.OleDb.OleDbParameter;
p1.OleDbType = System.Data.OleDb.OleDbType.VarWChar;
Comm.Parameters.Add(p1);
}
else
{
Comm.Parameters.Add(pa);
}
}
} Comm.ExecuteNonQuery();
FillParameterValue(Comm.Parameters, param);
Trans.Commit();
this.Conn.Close();
}
catch (Exception e)
{
Trans.Rollback();
this.Conn.Close();
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "] Error Message : " + e.ToString());
}
}
this.ErrorMessage = e.ToString();
throw new Exception(e.ToString());
}
}
#endregion ExecuteScalar#region ExecuteScalar
/**//// <summary>
/// 返回查询结果的第一行第一列的值
/// </summary>
/// <param name="strSQL"></param>
/// <returns></returns>
public object ExecuteScalar(string strSQL)
{
OleDbTransaction Trans;
Comm = new OleDbCommand();
Conn.Open();
Trans = Conn.BeginTransaction();
Comm.CommandText = strSQL;
Comm.Connection = Conn;
Comm.Transaction =Trans ;
Comm.CommandTimeout = 60;
try
{
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "] CommandString = " + strSQL);
SWApp.Close();
}
} object objResutl = Comm.ExecuteScalar();
Trans.Commit();
this.Conn.Close();
return objResutl;
}
catch (Exception e)
{
Trans.Rollback();
this.Conn.Close();
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "] Error Message : " + e.ToString());
}
}
this.ErrorMessage = e.ToString();
throw new Exception(e.ToString());
}
} /**//// <summary>
/// 返回查询结果的第一行第一列的值
/// </summary>
/// <param name="strSQL"></param>
/// <param name="param">参数集合</param>
/// <returns></returns>
public object ExecuteScalar(string strSQL,ICollection param)
{
OleDbTransaction Trans;
Comm = new OleDbCommand();
Conn.Open();
Trans = Conn.BeginTransaction();
Comm.CommandText = strSQL;
Comm.Connection = Conn;
Comm.Transaction =Trans ;
Comm.CommandTimeout = 60;
try
{
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "] CommandString = " + strSQL);
SWApp.Close();
}
}
if ( param != null )
{
foreach ( ParamInfo p in param )
{
IDbDataParameter pa = Comm.CreateParameter();
pa.ParameterName = p.Name;
pa.Value = p.Value;
pa.Direction = p.Direction; Comm.Parameters.Add(pa);
}
} object objResutl = Comm.ExecuteScalar();
FillParameterValue(Comm.Parameters,param);
Trans.Commit();
this.Conn.Close();
return objResutl; }
catch (Exception e)
{
Trans.Rollback();
this.Conn.Close();
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "] Error Message : " + e.ToString());
}
}
this.ErrorMessage = e.ToString();
throw new Exception(e.ToString());
}
}
#endregion ExecuteDataSet#region ExecuteDataSet
/**//// <summary>
/// 执行SQL语句并返回DataTable对象
/// </summary>
public DataSet ExecuteDataSet(string strSQL)
{
OleDbTransaction Trans;
Comm = new OleDbCommand();
Conn.Open();
Trans = Conn.BeginTransaction();
Comm.CommandText = strSQL;
Comm.Connection = Conn;
Comm.Transaction =Trans ;
Comm.CommandTimeout = 60;
DataSet ds = new DataSet();
try
{
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> Begin Get DataSet.");
SWApp.WriteLine("CommandString = " + strSQL);
SWApp.Close();
}
} try
{
IDataReader dr = Comm.ExecuteReader();
do
{
DataTable dt = new DataTable();
dt.Locale = CultureInfo.CurrentCulture; DataColumn col = null;
DataRowCollection rows = dr.GetSchemaTable().Rows;
foreach(DataRow row in rows)
{
col = new DataColumn();
col.ColumnName = row["ColumnName"] == null ? null : row["ColumnName"].ToString();
col.Unique = Convert.ToBoolean(row["IsUnique"]);
col.AllowDBNull = Convert.ToBoolean(row["AllowDBNull"]);
col.ReadOnly = Convert.ToBoolean(row["IsReadOnly"]);
col.DataType = row["DataType"] as Type; dt.Columns.Add(col);
} while (dr.Read())
{
DataRow row = dt.NewRow(); foreach(DataColumn c in dt.Columns)
{
row[c] = dr[c.ColumnName];
} dt.Rows.Add(row);
} ds.Tables.Add(dt);
}
while (dr.NextResult());
dr.Close();
Trans.Commit();
}
catch (Exception e)
{
Trans.Rollback();
this.ErrorMessage = e.ToString();
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> Error Message: " + e.ToString());
}
}
throw new Exception(e.ToString());
} if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> End of Getting DataSet.");
SWApp.Close();
}
}
}
finally
{
Conn.Close();
}
return ds;
} /**//// <summary>
/// 执行SQL语句并返回DataTable对象
/// <param name="strSQL">SQL语句</param>
/// <param name="param">参数集合</param>
/// </summary>
public DataSet ExecuteDataSet(string strSQL, ICollection param)
{
OleDbTransaction Trans;
Comm = new OleDbCommand();
Conn.Open();
Trans = Conn.BeginTransaction();
Comm.CommandText = strSQL;
Comm.Connection = Conn;
Comm.Transaction =Trans ;
Comm.CommandTimeout = 60;
DataSet ds = new DataSet();
try
{
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> Begin Get DataSet.");
SWApp.WriteLine("CommandString = " + strSQL);
SWApp.Close();
}
} try
{
if ( param != null )
{
foreach ( ParamInfo p in param )
{
IDbDataParameter pa = Comm.CreateParameter();
pa.ParameterName = p.Name;
pa.Value = p.Value;
pa.Direction = p.Direction; Comm.Parameters.Add(pa);
}
}
IDataReader dr = Comm.ExecuteReader(); do
{
DataTable dt = new DataTable();
dt.Locale = CultureInfo.CurrentCulture; DataColumn col = null;
DataRowCollection rows = dr.GetSchemaTable().Rows;
foreach(DataRow row in rows)
{
col = new DataColumn();
col.ColumnName = row["ColumnName"] == null ? null : row["ColumnName"].ToString();
col.Unique = Convert.ToBoolean(row["IsUnique"]);
col.AllowDBNull = Convert.ToBoolean(row["AllowDBNull"]);
col.ReadOnly = Convert.ToBoolean(row["IsReadOnly"]);
col.DataType = row["DataType"] as Type; dt.Columns.Add(col);
} while (dr.Read())
{
DataRow row = dt.NewRow(); foreach(DataColumn c in dt.Columns)
{
row[c] = dr[c.ColumnName];
} dt.Rows.Add(row);
} ds.Tables.Add(dt);
}
while (dr.NextResult());
dr.Close();
Trans.Commit();
}
catch (Exception e)
{
Trans.Rollback();
this.ErrorMessage = e.ToString();
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> Error Message: " + e.ToString());
}
}
throw new Exception(e.ToString());
} if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> End of Getting DataSet.");
SWApp.Close();
}
}
}
finally
{
Conn.Close();
}
return ds;
}
#endregion ExecuteDataTable#region ExecuteDataTable
/**//// <summary>
/// 执行SQL语句并返回DataTable对象
/// </summary>
public DataTable ExecuteDataTable(string strSQL)
{
return ExecuteDataSet(strSQL).Tables[0];
} /**//// <summary>
/// 执行SQL语句并返回DataTable对象
/// <param name="strSQL">SQL语句</param>
/// <param name="param">参数集合</param>
/// </summary>
public DataTable ExecuteDataTable(string strSQL, ICollection param)
{
return ExecuteDataSet(strSQL,param).Tables[0];
}
#endregion ExecuteDataReader#region ExecuteDataReader
/**//// <summary>
/// <param name="strSQL">SQL语句</param>
/// </summary>
public IDataReader ExecuteDataReader(string strSQL)
{
OleDbTransaction Trans;
Comm = new OleDbCommand();
Conn.Open();
Trans = Conn.BeginTransaction();
Comm.CommandText = strSQL;
Comm.Connection = Conn;
Comm.Transaction = Trans;
Comm.CommandTimeout = 60;
IDataReader dr ;
try
{
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> Begin Get DataReader.");
SWApp.WriteLine("CommandString = " + strSQL);
SWApp.Close();
}
} try
{
dr=Comm.ExecuteReader();
Trans.Commit();
}
catch (Exception e)
{
Trans.Rollback();
this.ErrorMessage = e.ToString();
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> Error Message: " + e.ToString());
}
}
throw new Exception(e.ToString());
} if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> End of Getting DataReader.");
SWApp.Close();
}
}
}
finally
{
Conn.Close();
}
return dr;
} /**//// <summary>
///
/// <param name="strSQL">SQL语句</param>
/// <param name="param">参数集合</param>
/// </summary>
public IDataReader ExecuteDataReader(string strSQL, ICollection param)
{
OleDbTransaction Trans;
Comm = new OleDbCommand();
Conn.Open();
Trans = Conn.BeginTransaction();
Comm.CommandText = strSQL;
Comm.Connection = Conn;
Comm.Transaction = Trans;
Comm.CommandTimeout = 60;
IDataReader dr;
try
{
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> Begin Get DataReader.");
SWApp.WriteLine("CommandString = " + strSQL);
SWApp.Close();
}
} try
{
if (param != null)
{
foreach (ParamInfo p in param)
{
IDbDataParameter pa = Comm.CreateParameter();
pa.ParameterName = p.Name;
pa.Value = p.Value;
pa.Direction = p.Direction; Comm.Parameters.Add(pa);
}
}
dr = Comm.ExecuteReader();
Trans.Commit();
}
catch (Exception e)
{
Trans.Rollback();
this.ErrorMessage = e.ToString();
if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> Error Message: " + e.ToString());
}
}
throw new Exception(e.ToString());
} if (_writeLog)
{
using (SWApp = File.AppendText(_path))
{
SWApp.WriteLine("[" + DateTime.Now.ToString() + "]==> End of Getting DataReader.");
SWApp.Close();
}
}
}
finally
{
Conn.Close();
}
return dr;
}
#endregion FillParameterValue#region FillParameterValue
/**//// <summary>
/// 填充输出型参数和返回值型参数
/// </summary>
/// <param name="OutPutParameters">SQL命令执行后的参数集合</param>
/// <param name="param">SQL命令执行前的参数集合</param>
void FillParameterValue(System.Data.IDataParameterCollection OutPutParameters, ICollection param)
{
if (OutPutParameters == null || param == null) return; ArrayList procParam = new ArrayList();
foreach (IDbDataParameter OleDbParameter in OutPutParameters)
{
foreach (ParamInfo p in param)
{
if (p.Name == OleDbParameter.ParameterName)
{
procParam.Add(new ParamInfo(p.Name, OleDbParameter.Value, p.Direction, p.Size));
}
}
} ArrayList procOutParam = param as ArrayList;
procOutParam.Clear();
foreach (ParamInfo p in procParam) //填充参数值
{
procOutParam.Add(new ParamInfo(p.Name, p.Value, p.Direction, p.Size));
}
}
#endregion
} ParamInfo#region ParamInfo
/**//// <summary>
/// SQL参数结构体
/// </summary>
public struct ParamInfo
{
/**//// <summary>
/// 参数名称
/// </summary>
public string Name; /**//// <summary>
/// 值
/// </summary>
public object Value; /**//// <summary>
/// 参数长度
/// </summary>
public int Size; /**//// <summary>
/// 参数方向
/// </summary>
public ParameterDirection Direction; /**//// <summary>
/// 初始化参数对象
/// </summary>
/// <param name="name">参数名称</param>
/// <param name="val">值</param>
public ParamInfo(string name, object val)
{
Name = name;
Value = val;
Direction = ParameterDirection.Input;
Size = Value == null ? 50 : Value.ToString().Length;
} /**//// <summary>
/// 初始化参数对象
/// </summary>
/// <param name="name">参数名称</param>
/// <param name="val">值</param>
/// <param name="direction"></param>
public ParamInfo(string name, object val, ParameterDirection direction)
{
Name = name;
Value = val;
Direction = direction;
Size = Value == null ? 50 : Value.ToString().Length;
} public ParamInfo(string name, object val, ParameterDirection direction, int size)
{
Name = name;
Value = val;
Direction = direction;
Size = size;
}
}
#endregion
}
Accesshelper.cs的更多相关文章
- 连接ACCESS的AccessHelper.cs类
using System; using System.Data; using System.Configuration; using System.Data.OleDb; using System.C ...
- [知识库分享系列] 二、.NET(ASP.NET)
最近时间又有了新的想法,当我用新的眼光在整理一些很老的知识库时,发现很多东西都已经过时,或者是很基础很零碎的知识点.如果分享出去大家不看倒好,更担心的是会误人子弟,但为了保证此系列的完整,还是选择分享 ...
- [C#] 剖析 AssemblyInfo.cs - 了解常用的特性 Attribute
剖析 AssemblyInfo.cs - 了解常用的特性 Attribute [博主]反骨仔 [原文]http://www.cnblogs.com/liqingwen/p/5944391.html 序 ...
- Atitit 软件架构方法的进化与演进cs bs soa roa msa attilax总结
Atitit 软件架构方法的进化与演进cs bs soa roa msa attilax总结 1.1. 软件体系架构是沿着单机到 CS 架构,再到 BS 的三层架构甚至多层架构逐步发展过来的,关于 ...
- 从java文件和CS文件里查询方法使用次数工具
前几天,领导让我找一下老系统(Java)里getRemoteUser方法都哪个文件用了,package是什么,方法被调用了多少次,当时因为着急,所以,直接人工找的,但是以后要是再出现,人工找就太讨厌了 ...
- 关于 WP 开发中.xaml 与.xaml.cs 的关系
今天我们先来看一下在WP8.1开发中最长见到的几个文件之间的关系.比较论证,在看这个问题之前我们简单看看.NET平台其他两个不同的框架: Windows Forms 先看看Window Forms中的 ...
- .net 用户控件ascx.cs注册js脚本代码无效果
在.net web项目中碰到一个比较奇怪的问题,网上没找到解决方案,先自己mark一下 问题描述: 添加一个用户控件ascx,在后端.cs添加js注册脚本,执行后没有弹出框 注册脚本为: this.P ...
- DateHelper.cs日期时间操作辅助类C#
//==================================================================== //** Copyright © classbao.com ...
- 仅用aspx文件实现Ajax调用后台cs程序。(实例)
仅用aspx文件实现Ajax调用后台cs无刷新程序.(实例) 两个文件:aaa.aspx 和aaa.aspx.cs 一.aaa.aspx <script type="text/java ...
随机推荐
- javaScript动画2 scroll家族
offsetWidth和offsetHight (检测盒子自身宽高+padding+border) 这两个属性,他们绑定在了所有的节点元素上.获取之后,只要调用这两个属性,我们就能够获取元素节点的宽和 ...
- NGUI混合FingerGesture《卷二》分离触摸事件
背景 在使用NGUI按钮组件的时候,点击按钮同时触发FingerGesture的Touch事件, 通俗点讲,NGUI点击之后,点击事件被FingerGesture又执行了一遍. 解决思路 持有一个全局 ...
- LeetCode 902. Numbers At Most N Given Digit Set
应该是常数 N的位数时间级别 我的这个方法超时很严重...但是特此记录 费劲巴拉写的... 超时: int atMostNGivenDigitSet(char** D, int DSize, int ...
- OpenVPN GUI出现CreateProcess错误的解决方法
问题描述 启动 OpenVPN GUI 时失败,提示“CreateProcess Failed, exe=’X:\XXXXX\OpenVPN\bin\openvpn.exe’ cmdline= ...
- oracle lpad 函数使用介绍
函数介绍 lpad函数从左边对字符串使用指定的字符进行填充.从其字面意思也可以理解,l是left的简写,pad是填充的意思,所以lpad就是从左边填充的意思. 语法格式如下: lpad( string ...
- JAVA面试题整理(1)-基础
1.List 和 Set 的区别 共同点:它们都是Collection的子接口 区别: List:这个接口能够精准的记录每一个元素的插入位置(换句话说就是这个接口内容所有元素是按照顺序去保存的),使 ...
- 20135302魏静静Linux内核分析第二周学习总结
操作系统是如何工作的 1. 小结:计算机是怎样工作的 三个法宝 存储程序计算机.函数调用堆栈.中断机制 两把宝剑 中断上下文.进程上下文的切换 2. 堆栈 堆栈是C语言程序运行时必须的一个记录调用路径 ...
- Leetcode(93): Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combina ...
- 关于JavaScript对象,你所不知道的事(二)- 再说属性
说完了对象那些不常用的冷知识,是时候来看看JavaScript中对象属性有哪些有意思的东西了. 不出你所料,对象属性自然也有其相应的特征属性,但是这个话题有点复杂,让我们先从简单的说起,对象属性的分类 ...
- 【论文解析】MTCNN论文要点翻译
目录 0.论文连接 1.前言 2.论文Abstract翻译 3.论文的主要贡献 4.4 训练 5 模型性能分析 5.1 关于在线挖掘困难样本的性能 5.2 将人脸检测与对齐联合的性能 5.3 人脸检测 ...