This commit is contained in:
sunkaixuan 2017-09-12 18:56:01 +08:00
parent 2cf85ba888
commit 54b082e75b

View File

@ -226,6 +226,8 @@ namespace SqlSugar
#region Core
public virtual int ExecuteCommand(string sql, params SugarParameter[] parameters)
{
try
{
if (this.ProcessingEventStartingSQL != null)
ExecuteProcessingSQL(ref sql, parameters);
@ -235,9 +237,17 @@ namespace SqlSugar
if (this.IsClearParameters)
sqlCommand.Parameters.Clear();
ExecuteAfter(sql, parameters);
if (this.IsClose()) this.Close();
return count;
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (this.IsClose()) this.Close();
}
}
public virtual IDataReader GetDataReader(string sql, params SugarParameter[] parameters)
{
var isSp = this.CommandType == CommandType.StoredProcedure;
@ -254,6 +264,8 @@ namespace SqlSugar
return sqlDataReader;
}
public virtual DataSet GetDataSetAll(string sql, params SugarParameter[] parameters)
{
try
{
if (this.ProcessingEventStartingSQL != null)
ExecuteProcessingSQL(ref sql, parameters);
@ -266,10 +278,20 @@ namespace SqlSugar
if (this.IsClearParameters)
sqlCommand.Parameters.Clear();
ExecuteAfter(sql, parameters);
if (this.IsClose()) this.Close();
return ds;
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (this.IsClose()) this.Close();
}
}
public virtual object GetScalar(string sql, params SugarParameter[] parameters)
{
try
{
if (this.ProcessingEventStartingSQL != null)
ExecuteProcessingSQL(ref sql, parameters);
@ -280,9 +302,17 @@ namespace SqlSugar
if (this.IsClearParameters)
sqlCommand.Parameters.Clear();
ExecuteAfter(sql, parameters);
if (this.IsClose()) this.Close();
return scalar;
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (this.IsClose()) this.Close();
}
}
#endregion
#region Methods