苍苍网 > 软件资讯 > asp.net中IDataPa!rameter调用存储过程的实现方法

asp.net中IDataPa!rameter调用存储过程的实现方法
2020-09-09 17:28:53   

具体实现方法如下:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 public string GenerateExamePaper(string paperType, string driverID, string MacAddr) { 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 (SqlCo
好看的搞笑gif[www.62-6.com/1/gaoxiaogif/]nnection 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; } }
医用膏药布 http://hanchenyiyao66.51sole.com
热点推荐
今日点击排行