Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 stored procedure output parameter issue

Author  Topic 

kranthi_victroy
Starting Member

5 Posts

Posted - 2007-08-27 : 22:15:30
Hi,
the stored procedure returns only the first letter of the ouput parameter i.e 'e'. spvr_ErrorDescription='error while updating data'. Actually It must return 'error while updating data'. can anybody help
me to solve this issue.How to set the size of output parameter
in dataaccess layer.

Below is the actual code




public string UserCostCenter_Upd(string spvp_Offering,
string spvp_UserId,
string spvp_CostCenter,
DateTime spvp_StartDate,
DateTime spvp_ExpiryDate,
ref string spvr_ErrorDescription)
{
// The instance ds will hold the result set obtained from the DataRequest
DataSet ds = new DataSet();
RequestParameter[] parms = new RequestParameter[7];
parms[0] = new RequestParameter("@Return_Value", DbType.Int32, ParameterDirection.ReturnValue, null, true);
parms[1] = new RequestParameter("@p_Offering", DbType.AnsiString);
parms[1].Value = spvp_Offering;
parms[2] = new RequestParameter("@p_UserId", DbType.AnsiStringFixedLength);
if (spvp_UserId == null)
parms[2].Value = DBNull.Value;
else
parms[2].Value = spvp_UserId;
parms[3] = new RequestParameter("@p_CostCenter", DbType.AnsiString);
if (spvp_CostCenter == null)
parms[3].Value = DBNull.Value;
else
parms[3].Value = spvp_CostCenter;
parms[4] = new RequestParameter("@p_StartDate", DbType.DateTime);
if (spvp_StartDate == null)
parms[4].Value = DBNull.Value;
else
parms[4].Value = spvp_StartDate;
parms[5] = new RequestParameter("@p_ExpiryDate", DbType.DateTime);
if (spvp_ExpiryDate == null)
parms[5].Value = DBNull.Value;
else
parms[5].Value = spvp_ExpiryDate;
parms[6] = new RequestParameter("@r_ErrorDescription", DbType.String, ParameterDirection.InputOutput , null, true);
parms[6].Value = spvr_ErrorDescription;

// Create an instance of DataSQLClient

AirProducts.GlobalIT.Framework.DataAccess.DataSqlClient daSQL = new DataSqlClient(Constants.ApplicationName); ;
// typDSRef holds the ref. to the strongly typed dataset
DataSet typDSRef = (DataSet)ds;
DataSet resultDataSet = daSQL.ExecuteDataSet("[ap_UserCostCenter_Upd]", ref parms);
// Call DataHelper.MapResultSet function for mapping the result set obtained in ordinary DataSet to strongly typed DataSet
DataHelper helper = new DataHelper();
if (!helper.MapResultSet(ref typDSRef, resultDataSet))
ds = null; // Returns a null reference if the DataHelper.MapResultSet is failed.
//returnCode = (int)parms[0].Value;
spvr_ErrorDescription = (string)((parms[6].Value == DBNull.Value) ? null : parms[6].Value);
return spvr_ErrorDescription ;
}

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-27 : 22:30:09
Dup post:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=88493
Go to Top of Page
   

- Advertisement -