using System; using System.Collections.Generic; using System.Collections; using System.Text; using System.Data; using System.Data.SqlClient; //using System.Timers; namespace SysBaseLibs { public delegate void evDBConnectionError(string pcCommand, string pcMessage, string pcErrorNumbers); public delegate void evDBConnectionAction(string pcCommand,string pcMessage); public class DBConnSql : IErrorMsg { // Fields private SqlDataAdapter _Adapter=null; private SqlConnection _Connection=null; private string _ConnectionString=null; protected DbConnStatus _Status=DbConnStatus.Error; private SqlTransaction _Transaction=null; // private Timer _timer = null; // Events public event evDBConnectionError OnDBConnectionError; public event evDBConnectionAction OnDBConnectionAction; // Methods public DBConnSql() { this._Adapter = new SqlDataAdapter(); this._DataSet = null; this._Adapter.RowUpdated += new SqlRowUpdatedEventHandler(this._Adapter_RowUpdated); this._DataSet = new DataSet(); this._ConnectionString = DALibs.CenterConnectionStr; } private void _Adapter_RowUpdated(object sender, SqlRowUpdatedEventArgs e) { if (e.Errors != null) { this.FireDBConnectionError(" RowUpdated ", e.ToString(), e.Errors.Message); } } /// /// 打开数据库连接 /// /// public bool Open() { bool llRetVal = true; if (_ConnectionString=="") _ConnectionString = DALibs.CenterConnectionStr; try { _Connection = new SqlConnection(_ConnectionString); _Connection.Open(); this._Status = DbConnStatus.Open; } catch (Exception e) { _ErrorMsg = "OpenConnection " + " Establishing Connection " + " \r\n " + e.Message; this.FireDBConnectionError("OpenConnection", "Establishing Connection", e.Message); llRetVal = false; } return llRetVal; } /// /// 打开数据库连接 /// /// /// public bool Open(string pcConnString) { _ConnectionString = pcConnString; return Open(); } /// /// 关闭数据库连接 /// public void Close() { if (this._Connection != null) { this._Connection.Close(); this._Connection.Dispose(); this._Connection = null; this._Status = DbConnStatus.Close; } } /// /// 开始事务 /// /// public bool BeginTrans() { bool llRetVal = false; if (this._Connection != null && this._Transaction == null) { try { _Transaction = this._Connection.BeginTransaction(); } catch (SqlException e) { _ErrorMsg = "BeginTrans " + " Start transaction: " + " \r\n " + e.Message; this.FireDBConnectionError("BeginTrans", "Start transaction: ", e.Message); } _ErrorMsg = ""; llRetVal = true; } return llRetVal; } /// /// 确认事务 /// /// public bool CommitTrans() { if (_Transaction != null) { try { _Transaction.Commit(); } catch (SqlException e) { _ErrorMsg = "CommitTrans: " + " Commit transaction: " + " \r\n " + e.Message; this.FireDBConnectionError("CommitTrans", "Commit transaction: ", e.Message); } _ErrorMsg = ""; _Transaction.Dispose(); _Transaction = null; } return true; } /// /// 回滚事务 /// /// public bool RollbackTrans() { if (this._Transaction != null) { try { _Transaction.Rollback(); } catch (SqlException e) { this.FireDBConnectionError("RollbackTrans", "Rollback transaction: ", e.Message); } _Transaction.Dispose(); _Transaction = null; } return true; } /// /// 在事务控制下,执行一个SQL语句 /// /// /// public bool ExcuteSqlTran(string pcCommand) { bool lbRetVal = false; if (this.BeginTrans()) { if (this.ExecuteSql(pcCommand)) { lbRetVal = true; this.CommitTrans(); } else this.RollbackTrans(); } return lbRetVal; } /// /// 执行SQL语句 /// /// /// public bool ExecuteSql(string pcCommand) { FireDBConnectionAction("ExecuteSql", pcCommand + " "); bool llRetVal = false; if (this._Connection != null) { try { SqlCommand loCommand = new SqlCommand(pcCommand, this._Connection, this._Transaction); loCommand.ExecuteNonQuery(); llRetVal = true; } catch (Exception e) { _ErrorMsg ="ExecuteSql: "+ pcCommand+" \r\n "+ e.Message; this.FireDBConnectionError("ExecuteSql", pcCommand, e.Message); llRetVal = false; } } return llRetVal; } //@TableName varchar(500), --查询的数据表名 //@SelectFieldNames varchar(2000)='*', --查询的字段名称(不能包含"SELECT"关键字;以","隔开) //@StrWhere nvarchar(2000)=NULL, --查询条件字符串(不能包括"WHERE"关键字) //@OrderBy varchar(500)=NULL, --排序字段连接字符串(不能包含"ORDER BY"关键字;以","隔开) //@OrderType bit=0, --排序类型(0:升序;非0:降序) //@PageIndex int=1, --当前页码索引,默认1 //@PageSize int=10, --每页显示的记录大小,默认10 //@RowCount int=0 output, --总行数(记录数),默认0(输出参数) //@PageCount int=0 output --总页数;默认0(输出参数) /// /// /// /// 查询的数据表名 /// 主键 /// 查询的字段名称(不能包含"SELECT"关键字;以","隔开) /// 查询条件字符串(不能包括"WHERE"关键字) /// 排序字段连接字符串(不能包含"ORDER BY"关键字;以","隔开) /// 排序类型(0:升序;非0:降序) /// 当前页码索引,默认1 /// 每页显示的记录大小,默认10 /// 总行数(记录数),默认0(输出参数) /// 总页数;默认0(输出参数) /// public DataSet GetPageRecords(string pcTableName, string pcPrimaryKey, string pcSelectFieldNames, string pcStrWhere, string pcOrderBy, int piOrderType, int piPageIndex, int piPageSize, out int piRowCount, out int piPageCount) { IdCollection loColl = new IdCollection(); SqlSPPar loSPpar = new SqlSPPar("TableName", SqlDbType.VarChar); loSPpar.ParaLength = 500; loSPpar.ParameterValue = pcTableName; loColl.Add(loSPpar); loSPpar = new SqlSPPar("PrimaryKey", SqlDbType.VarChar); loSPpar.ParaLength = 100; loSPpar.ParameterValue = pcPrimaryKey; loColl.Add(loSPpar); loSPpar = new SqlSPPar("SelectFieldNames", SqlDbType.VarChar); loSPpar.ParaLength = 2000; loSPpar.ParameterValue = pcSelectFieldNames; loColl.Add(loSPpar); loSPpar = new SqlSPPar("StrWhere", SqlDbType.NVarChar); loSPpar.ParaLength = 2000; loSPpar.ParameterValue = pcStrWhere; loColl.Add(loSPpar); loSPpar = new SqlSPPar("OrderBy", SqlDbType.VarChar); loSPpar.ParaLength = 2000; loSPpar.ParameterValue = pcOrderBy; loColl.Add(loSPpar); loSPpar = new SqlSPPar("OrderType", SqlDbType.Int); loSPpar.ParameterValue = piOrderType + ""; loColl.Add(loSPpar); loSPpar = new SqlSPPar("PageIndex", SqlDbType.Int); loSPpar.ParameterValue = piPageIndex + ""; loColl.Add(loSPpar); loSPpar = new SqlSPPar("PageSize", SqlDbType.Int); //loSPpar.ParaLength = 5; loSPpar.ParameterValue = piPageSize + ""; loColl.Add(loSPpar); piRowCount = 0; loSPpar = new SqlSPPar("RowCount", SqlDbType.Int); loSPpar.ParameterValue = piRowCount + ""; loSPpar.IsOutput = true; loColl.Add(loSPpar); piPageCount = 0; loSPpar = new SqlSPPar("PageCount", SqlDbType.Int); loSPpar.ParameterValue = piPageCount + ""; loSPpar.IsOutput = true; loColl.Add(loSPpar); DataSet loRetVal = new DataSet(); if (!ExecuteStoredProc("p_Pagination", loColl, loRetVal)) { loRetVal = null; } piRowCount = Utils.ValI(((SqlSPPar)loColl[8]).ParameterValue.ToString()); piPageCount = Utils.ValI(((SqlSPPar)loColl[9]).ParameterValue.ToString()); return loRetVal; } ///************************************************************* //Description:常用分页查询存储过程 //**************************************************************/ //CREATE PROC [dbo].[p_Pagination] //@TableName varchar(500), --查询的数据表名 //@SelectFieldNames varchar(2000)='*', --查询的字段名称(不能包含"SELECT"关键字;以","隔开) //@StrWhere nvarchar(2000)=NULL, --查询条件字符串(不能包括"WHERE"关键字) //@OrderBy varchar(500)=NULL, --排序字段连接字符串(不能包含"ORDER BY"关键字;以","隔开) //@OrderType bit=0, --排序类型(0:升序;非0:降序) //@PageIndex int=1, --当前页码索引,默认1 //@PageSize int=10, --每页显示的记录大小,默认10 //@RowCount int=0 output, --总行数(记录数),默认0(输出参数) //@PageCount int=0 output --总页数;默认0(输出参数) //AS //BEGIN // --局部变量声明 // DECLARE @StrSQL Nvarchar(4000), --分页主查询SQL语句变量 // @StrGetCountSQL Nvarchar(4000), --查询总行数SQL语句变量 // @PrimaryKey varchar(100), --主键列名称变量 // @StrOrderType varchar(4) --排序类型字符(0:ASC;1:DESC) // --查询该表的主键列名称 // SELECT @PrimaryKey=c.name FROM sysindexes AS i // JOIN sysindexkeys AS k on i.id = k.id AND i.indid = k.indid // JOIN sysobjects AS o on i.id = o.id // JOIN syscolumns AS c on i.id=c.id AND k.colid = c.colid // WHERE o.xtype = 'U' AND // EXISTS(SELECT 1 FROM sysobjects WHERE xtype = 'PK' and name = i.name) // AND o.name=@TableName // --判断页码是否小于0 // IF(@PageIndex <1)SET @PageIndex=1; // IF(@SelectFieldNames='')SET @SelectFieldNames='*'; //-- SET @StrWhere=LTRIM(RTRIM(@StrWhere)); //-- SET @StrWhere=LTRIM(RTRIM(@StrWhere)); // --判断查询条件是否为NULL或空字符串 // IF ((@StrWhere IS NULL) OR (@StrWhere = '') ) // BEGIN // SET @StrWhere=''; // END // ELSE // BEGIN // SET @StrWhere=' AND '+@StrWhere; // END // --判断排序条件是否为NULL或空字符串 // IF ((@OrderBy IS NULL) OR (@OrderBy = '') ) // BEGIN // SET @OrderBy=''; // END // ELSE // BEGIN // --判断排序类型 // IF(@OrderType=0) // SET @StrOrderType='ASC'; // ELSE // SET @StrOrderType='DESC'; // SET @OrderBy=' Order By '+@OrderBy+' '+@StrOrderType; // END // --初始化查询记录总行数SQL语句 // SET @StrGetCountSQL='SELECT @RowCount=COUNT(*) FROM '+@TableName +' WHERE 1=1 '+@StrWhere; // --初始化分页查询SQL语句 // SET @StrSQL='SELECT TOP '+STR(@PageSize)+' '+@SelectFieldNames+' FROM '+@TableName // +' WHERE '+@PrimaryKey+' NOT IN ( SELECT TOP '+STR(@PageSize*(@PageIndex-1))+' ' // +@PrimaryKey+' FROM '+@TableName +' WHERE 1=1 '+@StrWhere+@OrderBy+' ) ' // +@StrWhere+@OrderBy; // --输出查询语句 // print @StrGetCountSQL // print @StrSQL // --执行SQL查询语句 // --EXEC(@StrGetCountSQL)--错误的执行带参数的方法 // --正确的方法;声明变量输出 // EXEC SP_EXECUTESQL @StrGetCountSQL,N'@RowCount int OUT',@RowCount out // --计算总页数 // SET @PageCount=@RowCount/@PageSize // IF(@RowCount%@PageSize<>0)SET @PageCount=@PageCount+1; // EXEC(@StrSQL) //END //GO public DataSet GetPageRecords_RowNum(string pcTableName, string pcSelectFieldNames, string pcStrWhere, string pcOrderBy, int piPageIndex, int piPageSize, out int piRowCount, out int piPageCount) { IdCollection loColl = new IdCollection(); SqlSPPar loSPpar = new SqlSPPar("TableName", SqlDbType.VarChar) { ParaLength = 500, ParameterValue = pcTableName }; loColl.Add(loSPpar); loSPpar = new SqlSPPar("SelectFieldNames", SqlDbType.VarChar) { ParaLength = 2000, ParameterValue = pcSelectFieldNames }; loColl.Add(loSPpar); loSPpar = new SqlSPPar("StrWhere", SqlDbType.NVarChar) { ParaLength = 4000, ParameterValue = pcStrWhere }; loColl.Add(loSPpar); loSPpar = new SqlSPPar("OrderBy", SqlDbType.VarChar) { ParaLength = 2000, ParameterValue = pcOrderBy }; loColl.Add(loSPpar); loSPpar = new SqlSPPar("PageIndex", SqlDbType.Int) {ParameterValue = piPageIndex + ""}; loColl.Add(loSPpar); loSPpar = new SqlSPPar("PageSize", SqlDbType.Int) {ParameterValue = piPageSize + ""}; //loSPpar.ParaLength = 5; loColl.Add(loSPpar); piRowCount = 0; loSPpar = new SqlSPPar("RowCount", SqlDbType.Int) { ParameterValue = piRowCount + "", IsOutput = true }; loColl.Add(loSPpar); piPageCount = 0; loSPpar = new SqlSPPar("PageCount", SqlDbType.Int) { ParameterValue = piPageCount + "", IsOutput = true }; loColl.Add(loSPpar); DataSet loRetVal = new DataSet(); if (!ExecuteStoredProc("Pr_Pagination_RowNum", loColl, loRetVal)) { loRetVal = null; } piRowCount = Utils.ValI(((SqlSPPar)loColl[6]).ParameterValue.ToString()); piPageCount = Utils.ValI(((SqlSPPar)loColl[7]).ParameterValue.ToString ()); return loRetVal; } public DataSet GetPageRecords(string pcQueryStr, int piPageSize, int piPageCurrent, string pcFdShow, string pcFdOrder) { IdCollection loColl = new IdCollection(); SqlSPPar loSPpar = new SqlSPPar("QueryStr", SqlDbType.NVarChar); loSPpar.ParaLength = 4000; loSPpar.ParameterValue = pcQueryStr; loColl.Add(loSPpar); loSPpar = new SqlSPPar("PageSize", SqlDbType.Int); //loSPpar.ParaLength = 2000; loSPpar.ParameterValue = piPageSize + ""; loColl.Add(loSPpar); loSPpar = new SqlSPPar("PageCurrent", SqlDbType.Int); //loSPpar.ParaLength = 5; loSPpar.ParameterValue = piPageCurrent + ""; loColl.Add(loSPpar); loSPpar = new SqlSPPar("FdShow", SqlDbType.NVarChar); loSPpar.ParaLength = 4000; loSPpar.ParameterValue = pcFdShow; loColl.Add(loSPpar); loSPpar = new SqlSPPar("FdOrder", SqlDbType.NVarChar); loSPpar.ParaLength = 1000; loSPpar.ParameterValue = pcFdOrder; loColl.Add(loSPpar); DataSet loRetVal = new DataSet(); if (!ExecuteStoredProc("p_Pagination", loColl, loRetVal)) { loRetVal = null; } return loRetVal; } public bool ExecuteStoredProc(string pcSPName, IdCollection poParams, DataSet poOutDataSet) { FireDBConnectionAction("ExecuteStoredProc", pcSPName + " "); bool llRetVal = false; if (this._Connection != null) { try { SqlCommand loCommand = new SqlCommand(pcSPName, this._Connection, this._Transaction); loCommand.CommandType = CommandType.StoredProcedure; foreach (SqlSPPar loParmObject in poParams) { SqlParameter loSqlParm = new SqlParameter("@" + loParmObject.ParameterName.Trim(), loParmObject.ParameterType); if (loParmObject.IsOutput) { loSqlParm.Direction = ParameterDirection.Output; if (loParmObject.ParaLength > 0) loSqlParm.Size = loParmObject.ParaLength; } else { loSqlParm.Direction = ParameterDirection.Input; loSqlParm.Value = loParmObject.ParameterValue; if (loParmObject.ParaLength > 0) loSqlParm.Size = loParmObject.ParaLength; } loCommand.Parameters.Add(loSqlParm); } this._Adapter.SelectCommand = loCommand; this._Adapter.Fill(poOutDataSet); foreach (SqlParameter loParam in loCommand.Parameters) { if (loParam.Direction == ParameterDirection.Output) { string lcOutputParm = loParam.ParameterName.TrimStart('@'); if (poParams[lcOutputParm] != null && poParams[lcOutputParm] is SqlSPPar) { SqlSPPar loOutputParm = (SqlSPPar)poParams[lcOutputParm]; loOutputParm.ParameterValue = loParam.Value.ToString(); } } } llRetVal = true; } catch (Exception e) { _ErrorMsg = "ExecuteStoredProc: " + pcSPName + " \r\n " + e.Message; this.FireDBConnectionError("ExecuteStoredProc", pcSPName, e.Message); } } return llRetVal; } /// /// 执行一个存储过程 /// /// 存储过程名 /// 存储过程的参数 /// 返回执行是否成功 public bool ExecuteStoredProc(string pcSPName, IdCollection poParams) { FireDBConnectionAction("ExecuteStoredProc", pcSPName+" "); bool llRetVal = false; if (this._Connection != null) { try { SqlCommand loCommand = new SqlCommand(pcSPName, this._Connection,this._Transaction); loCommand.CommandType = CommandType.StoredProcedure; foreach (SqlSPPar loParmObject in poParams) { SqlParameter loSqlParm = new SqlParameter("@" + loParmObject.ParameterName.Trim(), loParmObject.ParameterType); if (loParmObject.IsOutput) { loSqlParm.Direction = ParameterDirection.Output; if (loParmObject.ParaLength > 0) loSqlParm.Size = loParmObject.ParaLength; } else { loSqlParm.Direction = ParameterDirection.Input; loSqlParm.Value = loParmObject.ParameterValue; if (loParmObject.ParaLength > 0) loSqlParm.Size = loParmObject.ParaLength; } loCommand.Parameters.Add(loSqlParm); } loCommand.ExecuteNonQuery(); foreach (SqlParameter loParam in loCommand.Parameters) { if (loParam.Direction == ParameterDirection.Output) { string lcOutputParm = loParam.ParameterName.TrimStart('@'); if (poParams[lcOutputParm] != null && poParams[lcOutputParm] is SqlSPPar) { SqlSPPar loOutputParm = (SqlSPPar)poParams[lcOutputParm]; loOutputParm.ParameterValue = loParam.Value.ToString(); } } } llRetVal = true; } catch (Exception e) { _ErrorMsg = "ExecuteStoredProc: " + pcSPName + " \r\n " + e.Message; this.FireDBConnectionError("ExecuteStoredProc", pcSPName, e.Message); } } return llRetVal; } private void FireDBConnectionAction(string pcCommand, string pcMessage) { if (OnDBConnectionAction != null) { if (OnlyExec) { if (pcCommand == "ExecuteSql") OnDBConnectionAction(pcCommand, pcMessage); } else OnDBConnectionAction(pcCommand, pcMessage); } } private void FireDBConnectionError(string pcCommand, string pcMessage, string pcErrorMessage) { if (OnDBConnectionError != null) { OnDBConnectionError(pcCommand, pcMessage, pcErrorMessage); } } /// /// 执行SQL语句,返回XML的数据集和数据结构 /// /// /// /// /// public bool GetData(string pcSqlCommand, ref string pcXmlData, ref string pcXmlDataSchema) { return GetData("", pcSqlCommand, ref pcXmlData, ref pcXmlDataSchema); } public bool GetData(string pcTableName, string pcSqlCommand, ref string pcXmlData, ref string pcXmlDataSchema) { FireDBConnectionAction("GetData", pcSqlCommand); bool lbRetVal = false; DataSet loDS = OpenDataSet(pcTableName, pcSqlCommand); if (loDS != null && loDS.Tables.Count == 1) { pcXmlData = loDS.GetXml(); pcXmlDataSchema = loDS.GetXmlSchema(); lbRetVal = true; } return lbRetVal; } // 扩展 public bool GetData(string pcSqlCommand, ref string pcXmlData, ref string pcXmlDataSchema, ref int piRecCount) { return GetData("", pcSqlCommand, ref pcXmlData, ref pcXmlDataSchema, ref piRecCount); } public bool GetData(string pcTableName, string pcSqlCommand, ref string pcXmlData, ref string pcXmlDataSchema, ref int piRecCount) { FireDBConnectionAction("GetData", pcSqlCommand); bool lbRetVal = false; DataSet loDS = OpenDataSet(pcTableName, pcSqlCommand); if (loDS != null && loDS.Tables.Count == 1) { pcXmlData = loDS.GetXml(); pcXmlDataSchema = loDS.GetXmlSchema(); piRecCount = loDS.Tables[0].Rows.Count; lbRetVal = true; } return lbRetVal; } /// /// 打开一个dataset /// /// /// public DataSet OpenDataSet(string pcSqlCommand) { return OpenDataSet("", pcSqlCommand); } public DataSet OpenDataSet(string pcTableName, string pcSqlCommand) { FireDBConnectionAction("OpenDataSet", pcSqlCommand); DataSet dataSet = new DataSet(); if (this._Connection != null) { SqlCommand command = new SqlCommand(pcSqlCommand, this._Connection, this._Transaction); command.CommandTimeout = 60; this._Adapter.SelectCommand = command; try { if (pcTableName.Trim().Length == 0) this._Adapter.Fill(dataSet); else this._Adapter.Fill(dataSet, pcTableName); command.Dispose(); command = null; } catch (Exception e) { _ErrorMsg = pcSqlCommand + " \r\n " + e.ToString(); this.FireDBConnectionError("OpenDataSet", pcSqlCommand, e.Message); } } return dataSet; } /// /// 打开一个query /// /// /// public rsQuery OpenQuery(string pcSqlCommand) { rsQuery loRetVal = new rsQuery(); DataTable loTable = this.OpenDataTable(pcSqlCommand); loRetVal.OpenFromDataTable(loTable); return loRetVal; } /// /// 打开一个dataTable /// /// /// public DataTable OpenDataTable(string pcSqlCommand) { FireDBConnectionAction("OpenDataTable", pcSqlCommand); DataTable loRetVal = new DataTable(); if (this._Connection != null) { SqlCommand loComm = new SqlCommand(pcSqlCommand, this._Connection, this._Transaction); loComm.CommandTimeout = 60; this._Adapter.SelectCommand = loComm; try { this._Adapter.Fill(loRetVal); loComm.Dispose(); loComm = null; } catch (Exception e) { _ErrorMsg = "OpenDataTable: " + pcSqlCommand + " \r\n " + e.Message; this.FireDBConnectionError("OpenDataTable", pcSqlCommand, e.Message); } } return loRetVal; } /// /// 打开一个dataTable /// /// /// public DataTable OpenDataTable(DataSet poDataSet, string pcTableName, string pcSqlCommand) { FireDBConnectionAction("OpenDataTable", pcSqlCommand); DataTable table2 = null; if (this._Connection != null) { SqlCommand command = new SqlCommand(pcSqlCommand, this._Connection, this._Transaction); command.CommandTimeout = 60; if (poDataSet == null) { poDataSet = this._DataSet; } if (poDataSet.Tables.Contains(pcTableName)) { poDataSet.Tables[pcTableName].Columns.Clear(); poDataSet.Tables[pcTableName].Clear(); } this._Adapter.SelectCommand = command; try { this._Adapter.Fill(poDataSet, pcTableName); command.Dispose(); command = null; table2 = poDataSet.Tables[pcTableName]; } catch (Exception e) { _ErrorMsg = "OpenDataTable : 执行的语句 "+pcSqlCommand +" 错误信息: "+e.Message ; this.FireDBConnectionError("OpenDataTable", pcSqlCommand, e.Message); } } return table2; } #region Properties private DataSet _DataSet = null; public DataSet DataSetDB { get { return this._DataSet; } } private string _ErrorMsg = ""; public string ErrorMsg { get { return _ErrorMsg; } set { _ErrorMsg = value; } } public bool IsOpened { get { return (this._Status == DbConnStatus.Open); } } bool _OnlyExec=true; public bool OnlyExec { get { return _OnlyExec; } set { _OnlyExec = value; } } #endregion } public enum DbConnStatus { Open, Close, Error } public class SqlSPPar:INpId { // Fields private bool _IsOutput = false; private string _ParameterName; private SqlDbType _ParameterType; private object _ParameterValue = null; // Methods public SqlSPPar(string pcParameterName, SqlDbType pcParameterType) { this._ParameterName = pcParameterName.Trim(); this._ParameterType = pcParameterType; } public string Id { get { return _ParameterName; } set { } } // Properties public bool IsOutput { get { return this._IsOutput; } set { this._IsOutput = value; } } public string ParameterName { get { return this._ParameterName; } } public SqlDbType ParameterType { get { return this._ParameterType; } } public object ParameterValue { get { return this._ParameterValue; } set { this._ParameterValue = value; } } private int _ParaLength = 0; public int ParaLength { get { return _ParaLength; } set { _ParaLength = value; } } } }