サーバー上でストアド プロシージャを実行すると結果はINTERNAL
.ページ。else
INTERNAL
string usertype = u.ViewUserType((int)Session["Id"]);
string vattype = u.ViewUserVat((string)Session["Code"]);
if (usertype == "Client")
{
if (vattype == "INTERNAL")
{
Response.Redirect("~/NonIFAClient/");
}
else
{
Response.Redirect("~/Client/");
}
}
public string ViewUserVat(string code)
{
CamOnlineAccess.Utilities u = new CamOnlineAccess.Utilities();
SqlCommand c = u.GetCommandSP("dbo.ViewUserVat");
c.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] {
new System.Data.SqlClient.SqlParameter("@code",System.Data.SqlDbType.VarChar,50),
new System.Data.SqlClient.SqlParameter("@vat",SqlDbType.VarChar, 50, System.Data.ParameterDirection.Output, false, ((byte)(0)), ((byte)(0)), "", System.Data.DataRowVersion.Current, null)});
c.Parameters["@code"].Value = code;
c.Connection.Open();
c.ExecuteScalar(); // because we have output parameters
c.Connection.Close();
return (string)c.Parameters["@vat"].Value;
}
ストアド プロシージャ:
ALTER PROCEDURE [dbo].[ViewUserVat]
-- Add the parameters for the stored procedure here
@code varchar,
@vat varchar(50) output
AS
SELECT
TOP 1 @vat = vattable
FROM
dbo.portfolio
WHERE
owner = @code