大家好,又见面了,我是全栈君,祝每个程序员都可以多学几门语言。
{
int i;
IDataParameter[] iData = new SqlParameter[4];
iData[0] = new SqlParameter(“@paperType”, paperType);
iData[1] = new SqlParameter(“@driverID”, driverID);
iData[2] = new SqlParameter(“@MacAddr”, MacAddr);
iData[3] = new SqlParameter(“@sReturn”, SqlDbType.Char, 50, ParameterDirection.Output, false, 0, 0, string.Empty, DataRowVersion.Default,null);
string aaa = “”;
i= DbHelperSQL.RunProcedureParOut(“Pro_GenerateExamePaper”, iData, out aaa).ToString();
return aaa;
}
/// <summary>
/// 运行存储过程,返回影响的行数
/// </summary>
/// <param name=”storedProcName”>存储过程名</param>
/// <param name=”parameters”>存储过程參数</param>
/// <param name=”rowsAffected”>影响的行数</param>
/// <param name=”rowsAffected”>返回output值</param>
/// <returns></returns>
public static int RunProcedure(string storedProcName, IDataParameter[] parameters, out int rowsAffected,out str)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
int result;
connection.Open();
SqlCommand command = BuildIntCommand(connection, storedProcName, parameters);
rowsAffected = command.ExecuteNonQuery();
result = (int)command.Parameters[“ReturnValue”].Value;
str= (int)command.Parameters[“@sReturn”].Value;
return result;
}
}
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/118397.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...