Problem with new added column in customers and NopObjectContext

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 13 ans
Hi, i added to the Nop_Customer Table a new attribute "TEST"

I also added this to the NopModel.edmx file, manually at three position, Nop_customer, customer and the mapping.

In the administration when i search all Customers i get this error:

The data reader is incompatible with the specified 'NopSolutions.NopCommerce.BusinessLogic.Data.Customer'. A member of the type, 'test', does not have a corresponding column in the data reader with the same name.


It happened in the NopObjectContext.cs at Sp_CustomerLoadAll

how to fix it?
Il y a 13 ans
Any idea? I have installed NopCommerce 1.7, maybe it is solved in 1.8 ?!?
Il y a 13 ans
Yes you didn't update everything.. did you check the customermanager or the stored procedure?

Update the stored procedure in SQL and then update the db model in Nop.
Il y a 13 ans
Hi,  this is the stored procedure:

 <FunctionImport Name="Sp_CustomerLoadAll" EntitySet="Customers" ReturnType="Collection(NopSolutions.NopCommerce.BusinessLogic.Data.Customer)">
            <Parameter Name="StartTime" Mode="In" Type="DateTime" />
            <Parameter Name="EndTime" Mode="In" Type="DateTime" />
            <Parameter Name="Email" Mode="In" Type="String" />
            <Parameter Name="Username" Mode="In" Type="String" />
            <Parameter Name="DontLoadGuestCustomers" Mode="In" Type="Boolean" />
            <Parameter Name="PageSize" Mode="In" Type="Int32" />
            <Parameter Name="PageIndex" Mode="In" Type="Int32" />
            <Parameter Name="TotalRecords" Mode="InOut" Type="Int32" />
          </FunctionImport>

...

<FunctionImportMapping FunctionImportName="Sp_CustomerLoadAll" FunctionName="NopSolutions.NopCommerce.BusinessLogic.Data.Store.Nop_CustomerLoadAll" />





    <Function Name="Nop_CustomerLoadAll" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
          <Parameter Name="StartTime" Type="datetime" Mode="In" />
          <Parameter Name="EndTime" Type="datetime" Mode="In" />
          <Parameter Name="Email" Type="nvarchar" Mode="In" />
          <Parameter Name="Username" Type="nvarchar" Mode="In" />
          <Parameter Name="DontLoadGuestCustomers" Type="bit" Mode="In" />
          <Parameter Name="PageSize" Type="int" Mode="In" />
          <Parameter Name="PageIndex" Type="int" Mode="In" />
          <Parameter Name="TotalRecords" Type="int" Mode="InOut" />
        </Function>


And here is the call, which throws the exception:


var result = base.ExecuteFunction<Customer>("Sp_CustomerLoadAll", startTimeParameter,
                endTimeParameter, emailParameter, usernameParameter, dontLoadGuestCustomersParameter,
                pageSizeParameter, pageIndexParameter, totalRecordsParameter).ToList();



Why must i add here the new column of the customer?
Il y a 13 ans
SOLUTION:

Edit the Nop_CustomerLoadAll stored procedure of your databse, add the specific column to the query!
Il y a 13 ans
Correct me if I"m wrong so steps are:

1) adding a column in customer table.
2) updating model.demx file
3) updating stored procedure.

Right?
Il y a 12 ans
Hi,

I did the following steps.


1. I updated the stored procedure first for new column
2. On Data  clicked on "Update model from Database"
3. Build the Solns : Result -> Success

But i m still getting errors:

The data reader is incompatible with the specified 'NopSolutions.NopCommerce.BusinessLogic.Data.Product'. A member of the type, 'TermsAndConditions', does not have a corresponding column in the data reader with the same name.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.