Error 2048 - Foreign Key Mapping and Stored Procedures

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
chuck.sweet
Posts: 1
Joined: Thu 23 Apr 2009 13:49

Error 2048 - Foreign Key Mapping and Stored Procedures

Post by chuck.sweet » Thu 23 Apr 2009 14:25

I added a Stored Procedure to my Entity Model, and added it as an update stored procedure for my PRODUCT entity. The PRODUCT entity has a number of foreign keys pointing to other entities, which - according to error 2048, must be mapped into the stored procedures. I don't have access to modify the database, and the stored procedure doesn't accept parameters for some of the foreign key values (perfectly legal the way the database is set up).

Anyway, I found a fix to this problem which involved mapping the extra parameters into the stored procedure specification, and then set the command text to call the stored procedure without the extra parameters. I've tried, but the closest I've gotten so far is 'illegal variable name/number', which I'm recieving now. So, I guess my question is, what's wrong with my CommandText? Here it is:

USP_UPDATE_PRODUCT(:VAR1, :VAR2, :VAR3, :VAR4, :VAR5, :VAR6, :VAR7, :VAR8, :VAR9, :VAR10, :VAR11, :VAR12, :VAR13, :VAR14, :VAR15, :VAR16)

These are in the same order as they appear in the stored procedure declaration (the names have obviously been changed here, but you get the idea). Can I even do what I'm trying to do? here's a link to the article which gave me this lead (for the 2048 problem):


http://jamesmccaffrey.spaces.live.com/b ... 1161.entry

Thanks for any help![/url]

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 24 Apr 2009 13:19

I have tried the workaround described in the post and succeeded.
Please check the parameters collection for the type and the names consistency.
If everything seems to be correct, then please send us (support * devart * com, subject "EF: SP parameters problem")
the script of your procedure and the model, we will check it out.

Post Reply