You receive a "duplicate value for unique key member" error message when you log on to a Commerce Server site (838570)
The information in this article applies to:
- Microsoft Commerce Server 2002 SP2
- Microsoft Commerce Server 2000
SYMPTOMSWhen you log on to a Microsoft Commerce Server site, you may
receive the following error message: Server Error in '/'
Application.
--------------------------------------------------------------------------------
A duplicate value for unique key member Profile
Property found while building indices for profile
Profile Definition. Check the underlying store for
uniqueness of the property.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: A duplicate value
for unique key member Profile Property found while
building indices for profile Profile Definition.
Check the underlying store for uniqueness of the property.
Source Error: An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace: [COMException (0xc1004043): A duplicate value for unique key
memberProfile Property found while building indices
for profile Profile Definition. Check the underlying
store for uniqueness of the property. ]
Microsoft.CommerceServer.Interop.Profiles.ProfileServiceClass.GetProfileByKey(String
bstrKeyMemberName, Object sValue, String bstrType, Boolean bReturnError)
+0 Microsoft.CommerceServer.Runtime.Profiles.Profile..ctor(ProfileContext
profileService, String keyName, String keyValue, String profileType) +74
[CommerceProfileSystemException: Failed to retrieve profile.]
Microsoft.CommerceServer.Runtime.Profiles.Profile..ctor(ProfileContext
profileService, String keyName, String keyValue, String profileType) +277
Microsoft.CommerceServer.Runtime.Profiles.ProfileContext.GetProfile(String
keyName, String keyValue, String profileType) +183
CAUSECommerce Server will find a duplicate key when a user enters
a value and the same value exists in the database with spaces padded at the end
of the character string. This behavior occurs if the data type of the column
designated as a join key is configured in SQL to be a CHAR data type.
If the Profile database that the Commerce Server site uses contains a
value that has spaces appended to its character string, and you enter the same
value without the appended spaces, Commerce Server determines that you have
entered a duplicate key. This behavior may occur if the column of the data
member that the profile property references, and that is designated as a join
key, is configured in SQL Server to use a char data type.RESOLUTIONTo resolve this problem, change the value of the data type
from char to nvarchar for the column of the data member that the profile property
references. To do this, follow these steps:
- In Commerce Server Manager, expand Commerce Server
Manager, expand Global Resources, expand the profile
resource of the site, expand Profile Catalog, and then expand
Profile Definition.
- Open the profile definition that appears in the error
message, and then expand General Information Group.
- In the left pane, click the profile property that appears
in the error message, and then expand Advanced
Attributes.
- Click the button next to the Mapped Data
value.
- In the Data Source Picker -- Web Page
dialog box, notice the name of the table and the name of the column. Click
Cancel.
- In the left tree view, locate Microsoft SQL
Servers, expand SQL Server Groups, expand the name of
the server, expand Databases, and then expand Profile
Database.
- Locate the table name that you viewed in step 6.
Right-click this table name, and then click Design
Table.
- In the Design Table dialog box, locate the
column name that you viewed in step 6, and then change the data type of the
column from char to nvarchar.
- Close the Design Table dialog
box.
- Close Commerce Server Manager.
- Click Start, click Run, type IISRESET, and then click OK.
STATUS This
behavior is by design. Because the char data type is not suitable for international characters, Commerce
Server profiles were designed to use the nvarchar data type.
Modification Type: | Major | Last Reviewed: | 7/20/2004 |
---|
Keywords: | kbprb KB838570 kbAudDeveloper kbAudITPRO |
---|
|