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.
13 years ago
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?
13 years ago
Any idea? I have installed NopCommerce 1.7, maybe it is solved in 1.8 ?!?
13 years ago
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.
13 years ago
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?
13 years ago
SOLUTION:

Edit the Nop_CustomerLoadAll stored procedure of your databse, add the specific column to the query!
13 years ago
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?
12 years ago
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.