设为首页 加入收藏

TOP

[C#]分享一个以前的项目使用的DataBaseAccess类(五)
2014-11-24 14:34:34 来源: 作者: 【 】 浏览:11
Tags:分享 一个 以前 项目 使用 DataBaseAccess
uteSqlDs(string,string),Return Type:DataSet ");
return ExecuteSqlDs(new SqlCommand(strSql, this.conn), strTableName);
}


///


/// Execute SQL Command,return DataSet.
///

/// SQL Command which will be Executed
/// SQL Parameter Collection
/// table name
/// return DataSet.
public DataSet ExecuteSqlDs(string strSql, SqlParameter[] sqlParameters, string strTableName)
{
debug("Now Execute DataBaseAccess's Method:ExecuteSqlDs(string,SqlParameter[],string),Return Type:DataSet ");
return ExecuteSqlDs(SQLHelper.CreateCommand(strSql, sqlParameters, this.conn), strTableName);
}


#endregion


#region ExecuteSqlFillDs


///


/// Execute SQL Command,add new resultset into current ref DataSet.
///

/// SQL Command which will be Executed
/// table name
/// current Dataset
public void ExecuteSqlFillDs(SqlCommand sqlcmd, string strTableName, ref DataSet dsRef)
{
debug("Now Execute DataBaseAccess's Method:ExecuteSqlFillDs(SqlCommand,string,ref DataSet)");
sqlcmd.Connection = this.conn;
SqlDataAdapter sqlda = new SqlDataAdapter(sqlcmd);
try
{
debug("Execute SQL Command:" + sqlcmd.CommandText);
this.conn.Open();
sqlda.Fill(dsRef, strTableName);
}
catch (SqlException ex)
{
debug("Exception information:" + ex.ToString());
throw ex;
}
finally
{
sqlcmd.Dispose();
sqlda.Dispose();
this.conn.Close();
}
}


///


/// Execute SQL Command,add new resultset into current ref DataSet.
///

/// SQL Command which will be Executed
/// table name
/// current Dataset
public void ExecuteSqlFillDs(string strSql, string strTableName, ref DataSet dsRef)
{
debug("Now Execute DataBaseAccess's Method:ExecuteSqlFillDs(string,string,ref DataSet)");
ExecuteSqlFillDs(new SqlCommand(strSql),strTableName, ref dsRef);
}


///


/// Execute SQL Command,add new resultset into current ref DataSet.
///

/// SQL Command which will be Executed
/// SQL Parameters Collection
/// table name
/// Current Dataset
public void ExecuteSqlFillDs(string strSql, SqlParameter[] sqlParameters, string strTableName, ref DataSet dsRef)
{
debug("Now Execute DataBaseAccess's Method:ExecuteSqlFillDs(string strSql, SqlParameter[], string, ref DataSet)");
ExecuteSqlFillDs(SQLHelper.CreateCommand(strSql, sqlParameters, this.conn), strTableName, ref dsRef);
}


#endregion


#region ExecuteSqlDsEx


///


/// Define pagination(Execute SQL Command,return DataSet).
///

/// SQL Command which will be Executed
/// index of StartRecord
/// number of Records
/// table name
/// return DataSet
public DataSet ExecuteSqlDsEx(SqlCommand sqlcmd, int iStartRecord, int iMaxRecord, string strTableName)
{
首页 上一页 2 3 4 5 6 7 8 下一页 尾页 5/10/10
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇C# 在winform画面上点击某个区域.. 下一篇C#中生成验证码的类

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: