Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
While inserting data into a table using .Net entity framework stored procedure call a white space is appending at the end. this issue is with two columns only.
where both the columns are having a Foreign Key to different tables (the tables will have allowable values (constants)). 
FYI.

 1. column 1 is defined as varchar(6) and column 2 is defined varchar (3) in sql DB.
 2. but the foreign  key table 1 is having data with max length is 4, table 2 is having data with max length is 3.
 3.  in EDMX file below code is available 

a) 

    <Function Name="spInsertdetails" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
            <Parameter Name="column1" Type="char" Mode="In" />
            <Parameter Name="column2" Type="char" Mode="In" />
    
    b) <FunctionImport Name="spInsertdetails" ReturnType="Collection(TestDBModel.spInsertdetails_Result)">
                <Parameter Name="column1" Mode="In" Type="String" />
                <Parameter Name="column2" Mode="In" Type="String" />

Please let me know if any further details required.


What I have tried:

in 3.a) i have tried changing the char to varchar but the issue still present.
Posted
Updated 2-Dec-18 23:19pm
v2

1 solution

We need to change datatype to varchar in both Stored procedure as well in entity framework edmx, then in 3)a Function it will change to varchar, so it will not append space at the end.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900