ar();
return iReturnValueList;
}
}
trans.Commit();
}
catch (SqlException ex)
{
debug("Exception Information:" + ex.ToString());
trans.Rollback();
throw ex;
}
finally
{
this.conn.Close();
}
return iReturnValueList;
}
///
/// Execute mutil-SQL(insert,delete,update)command,keep an affair.
///
/// SQL Command collection which will be Executed
/// return the list number of the rows which are affected
public List ExecuteSqlDic(Dictionary dic)
{
debug("Now Execute DataBaseAccess's Method:ExecuteSqlDic(Dictionary),Return Type:List ");
return ExecuteSqlDic(dic, false);
}
#endregion
#region
///
/// Execute SQL Command,Return single Result.
///
/// SQL Command collection which will be Executed
/// return single Result
public object ExecScalar(SqlCommand sqlcmd)
{
debug("Now Execute DataBaseAccess's Method:ExecScalar(SqlCommand),Return Type:object ");
sqlcmd.Connection = this.conn;
try
{
debug("Execute SQL Command:" + sqlcmd.CommandText);
this.conn.Open();
object r = sqlcmd.ExecuteScalar();
//if (Object.Equals(r, null))
//{
// throw new Exception("object is null!");
//}
//else
//{
// return r;
//}
return r;
}
catch (SqlException ex)
{
debug("Exception Information:" + ex.ToString());
throw ex;
}
finally
{
sqlcmd.Dispose();
this.conn.Close();
}
}
///
/// Execute SQL Command,Return single Result.
///
/// SQL Command collection which will be Executed
/// return single Result
public object ExecScalar(string strSql)
{
debug("Now Execute DataBaseAccess's Method:ExecScalar(string),Return Type:object ");
return ExecScalar(new SqlCommand(strSql,this.conn));
}
///
/// Execute SQL Command,Return single Result.
///
/// SQL Command collection which will be Executed
/// SQL Parameters Collection
/// return single Result
public object ExecScalar(string strSql, SqlParameter[] sqlParameters)
{
debug("Now Execute DataBaseAccess's Method:ExecScalar(string,SqlParameter[]),Return Type:object ");
return ExecScalar(SQLHelper.CreateCommand(strSql, sqlParameters, this.conn));
}
#endregion
#region ExecScalarEx
///
/// Execute SQL command,if result set has note return 1,if result set is null return 0
///
/// SQL Command which will be Executed
/// Execute SQL command,if result set has note return 1,if result set is null return 0
public int ExecScalarEx(SqlCommand sqlcmd)
{
debug("Now E