I call SQL-proc which has 3 OUTPUT parameters. After calling proc, one of the parameters does not return a value when the other two do. The profiler shows that all 3 values are returned.
Parameters are declared as follows in proc ...
@UsrVariableID INT OUTPUT,
@OrganisationName NVARCHAR(256) OUTPUT,
@Visible bit OUTPUT
and the code that calls proc looks like this:
cm.Parameters.AddWithValue("@OrganisationName", name);
cm.Parameters["@OrganisationName"].Direction = ParameterDirection.Output;
cm.Parameters.AddWithValue("@Visible", visible);
cm.Parameters["@Visible"].Direction = ParameterDirection.Output;
cm.ExecuteNonQuery();
name = cm.Parameters["@OrganisationName"].Value.ToString();
visible = bool.Parse(cm.Parameters["@Visible"].Value.ToString());
id = int.Parse(cm.Parameters["@UsrVariableID"].Value.ToString());
The parameter that fails is @OrganisationName.
I am wondering if this is because the parameter has a type string in the code, but NVARCHAR in proc.
Does anyone have any ideas?
source
share