SqlHelper中,在使用存储过程时候,如果你的存储过程参数中有输出、返回参数。有些函数是无法使用的。具体来说就是:
比如:
public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
这个
public static int ExecuteNonQuery(string connectionString, string spName, params object[] parameterValues)
有提到的问题。
下面是有这些问题的函数列表:
public static int ExecuteNonQuery(string connectionString, string spName, params object[] parameterValues)
public static int ExecuteNonQuery(SqlConnection connection, string spName, params object[] parameterValues)
public static int ExecuteNonQuery(SqlTransaction transaction, string spName, params object[] parameterValues)
public static DataSet ExecuteDataset(string connectionString, string spName, params object[] parameterValues)
public static DataSet ExecuteDataset(SqlConnection connection, string spName, params object[] parameterValues)
public static DataSet ExecuteDataset(SqlTransaction transaction, string spName, params object[] parameterValues)
public static SqlDataReader ExecuteReader(string connectionString, string spName, params object[] parameterValues)
public static SqlDataReader ExecuteReader(SqlConnection connection, string spName, params object[] parameterValues)
public static SqlDataReader ExecuteReader(SqlTransaction transaction, string spName, params object[] parameterValues)
public static object ExecuteScalar(string connectionString, string spName, params object[] parameterValues)
public static object ExecuteScalar(SqlConnection connection, string spName, params object[] parameterValues)
public static object ExecuteScalar(SqlTransaction transaction, string spName, params object[] parameterValues)
public static XmlReader ExecuteXmlReader(SqlConnection connection, string spName, params object[] parameterValues)
public static XmlReader ExecuteXmlReader(SqlTransaction transaction, string spName, params object[] parameterValues)
public static void FillDataset(string connectionString, string spName,
public static void FillDataset(SqlConnection connection, string spName,
public static void FillDataset(SqlTransaction transaction, string spName,
这里的类似函数的特征就是参数中,其中一个参数是:
params object[] parameterValues
如果你非要使用这些函数,你就会看到,你接收不到返回的存储过程输出、返回参数。
原因:
可以参看其中一个函数的实现:
public static XmlReader ExecuteXmlReader(SqlConnection connection, string spName, params object[] parameterValues)
{
}