Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
212 Points
428 Posts
May 09, 2011 08:10 AM|LINK
A stored procedure is returning 2 output parameter. I tried to catch them in DAL using DAAB but couldn't succeed. Actually control did not returned on next lines. Please guide me.
using (DbCommand dbCommand = db.GetSqlStringCommand("p_AddLeaveApplication")) { dbCommand.CommandType = CommandType.StoredProcedure; db.AddInParameter(dbCommand, "@EmployeeId", DbType.Int16, leave.EmployeeId); db.AddInParameter(dbCommand, "@DateTo", DbType.Date,string.Format("'{0:yyyy-MM-dd HH:mm:ss}'", leave.DateTo)); db.AddInParameter(dbCommand, "@DateFrom", DbType.Date, string.Format("'{0:yyyy-MM-dd HH:mm:ss}'", leave.DateFrom)); db.AddInParameter(dbCommand, "@LeaveType", DbType.String, leave.LeaveType); db.AddOutParameter(dbCommand, "@Result", DbType.Int16, 1); db.AddOutParameter(dbCommand, "@LeaveId", DbType.Int16, 1); db.ExecuteNonQuery(dbCommand); LeaveId = Convert.ToInt16(db.GetParameterValue(dbCommand, "@LeaveId")); return result = Convert.ToInt16(db.GetParameterValue(dbCommand, "@Result")); }
Haansi
Member
212 Points
428 Posts
DAAB how to get multiple output parameters ?
May 09, 2011 08:10 AM|LINK
A stored procedure is returning 2 output parameter. I tried to catch them in DAL using DAAB but couldn't succeed. Actually control did not returned on next lines. Please guide me.
using (DbCommand dbCommand = db.GetSqlStringCommand("p_AddLeaveApplication")) { dbCommand.CommandType = CommandType.StoredProcedure; db.AddInParameter(dbCommand, "@EmployeeId", DbType.Int16, leave.EmployeeId); db.AddInParameter(dbCommand, "@DateTo", DbType.Date,string.Format("'{0:yyyy-MM-dd HH:mm:ss}'", leave.DateTo)); db.AddInParameter(dbCommand, "@DateFrom", DbType.Date, string.Format("'{0:yyyy-MM-dd HH:mm:ss}'", leave.DateFrom)); db.AddInParameter(dbCommand, "@LeaveType", DbType.String, leave.LeaveType); db.AddOutParameter(dbCommand, "@Result", DbType.Int16, 1); db.AddOutParameter(dbCommand, "@LeaveId", DbType.Int16, 1); db.ExecuteNonQuery(dbCommand); LeaveId = Convert.ToInt16(db.GetParameterValue(dbCommand, "@LeaveId")); return result = Convert.ToInt16(db.GetParameterValue(dbCommand, "@Result")); }Best Regards,
Haansi