1

Closed

Incorrect syntax near 'nvarchar'. Must declare the scalar variable "@".

description

tried to use the inheritance mapping. I get an error for each when a try to create a new FACTORY. I use the example from documentation with the entity map looking like
 
<Entity type="Domain:Company" table="Company" discriminator-field="Type"
discriminator-value="Company">
<Id field="CompanyId">
<Generator name="guid" />
</Id>
<Attribute name="Name" field="Name" db-type="String"/>
<Attribute name="SiretNb" field="SiretNb" db-type="Int32"/>
</Entity>
 
<Entity type="Domain:Factory" table="Company"
discriminator-field="Type"
discriminator-value="Factory" >
<Id field="CompanyId">
<Generator name="guid" />
</Id>
<Attribute name="City" field=" City " db-type="String"/>
</Entity>
 
 
I checked the query which looks like:
 
INSERT INTO [Company] ([CompanyId] , [ City ] , [Name] , [SiretNb] ) VALUES ( @EntityId , @ City , @Name , @SiretNb )
 
The parameters inside look fine and have the correct values. It happens only when I try to save values for derived class. Tried the same thing for the company class and works fine.
 
Thank you Cristian
 
btw I like your work
Closed Nov 16, 2009 at 10:25 AM by sebastienros
The issue is in the documentation, there is a typo issue in the mapping. The field for City should not contain a space.

comments

cristianrep wrote Nov 9, 2009 at 6:35 PM

Never mind. I figured it out.Seems then declaration <Attribute name="City" field=" City " db-type="String"/> has in [field] tag " CITY " with some spaces, as soon as they are removed then is works fine.