Hi
Recently while calling the store procedure using Output Parameter in asp.net, I was getting this error,
String[1]: the Size property has an invalid size of 0
There was returning the values as string from SP. I solverd the error by giving size of “SqlDbType.NVarChar” like this
using (SqlCommand cmd = new SqlCommand(“Test_Delete”, con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue(“@QmsId”, objBE.qmsId);
cmd.Parameters.Add(“@FileUrl”, SqlDbType.NVarChar,1000).Direction = ParameterDirection.Output;
//cmd.Parameters.Add(“@FileUrl”, objBE.fileURL);
con.Open();
cmd.ExecuteNonQuery();
fileUrl = cmd.Parameters[“@FileUrl”].Value.ToString();
return fileUrl;
}