Full username is not displayed after logging in

Julia Kurakula 46 Reputation points
2022-11-03T09:52:56.523+00:00

We are using DotNet WCF. This is DEV Code. When we pointed Dev database to TEST, it shows full username. So, I think there is issue with the WCF or the the stored procedure's out parameter is not completely taken in by the WCF code. Also, I think there's no issue with the WEB app since, I pointed endpoint address of test in DEV web.config and it shows full username.

WcfServiceSVC.cs logic:

public string GetEmpName(int employeeID)
{
var credLogic = new Logic.Credentials.CredentialsLogic();

            var empName = credLogic.GetEmpName(employeeID);  
  
            return empName;  
  
        }  

Credentials Logic:

public string GetEmpName(int employeeId)
{
string empName = string.Empty;

        Database abcDatabase;  
        DbCommand abcCommand = null;  

        try  
        {                 
            abcDatabase = DatabaseFactory.CreateDatabase(abcConnectString);  

            abcCommand = abcDatabase.GetStoredProcCommand("abc.ws_get_web_empname");  
            abcCommand.CommandType = CommandType.StoredProcedure;  

            // in  
            abcDatabase.AddInParameter(abcCommand, "p_emp_id", DbType.VarNumeric, employeeId);  

            // out  
            abcDatabase.AddOutParameter(abcCommand, "p_emp_name", DbType.String, 65);  

            // run  
            abcDatabase.ExecuteNonQuery(abcCommand);  
            empName = abcDatabase.GetParameterValue(abcCommand, "p_emp_name").ToString();  

            //Added:  
            //empName = abcCommand.Parameters[0].Value.ToString();  
            //Log("EmpId=" + employeeId.ToString() + ", EmpName: " + empName);  
        }  

Stored Procedure:

create or replace procedure ws_get_web_empname
(
p_emp_id in number,
p_emp_name out varchar2
)
as
begin

   select name_formatted_pcl  
 into p_emp_name  
     from people  
     where people_id = p_emp_id;  
   exception  
     when NO_DATA_FOUND then  
       p_emp_name := '';      

end;
Output is showing only First name + Initial of surname that is it shows "Julia K" and not the full name "Julia Kurakula". Let me know if you need further info to help me solve the issue.

Developer technologies .NET .NET Runtime
Developer technologies .NET Other
Developer technologies ASP.NET Other
SQL Server Other
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2022-11-03T22:24:41.697+00:00

    Maybe you should specify some size for your SQL variables and parameters, for example: p_emp_name out varchar2(100).

    In SQL Server varchar is the same thing as varchar(1). But Julia appears to be using Oracle (despite that she tagged her post with sql-server-general?), and I don't know what applies on Oracle.

    In any case, according to her screenshot, the expected value is Kurukula, Julia, so if she gets back Julia K, it is not a matter of mere truncation.

    I can think of two things:

    1. You are not connecting to the server/database you think you are connect to.
    2. There is something "interesting" with the table. Did you try running the stored procedure on its own to see what it returns?
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.