views:

416

answers:

3

Hi All,

I have a problem with adding a MS-SQL view to my Entity Data Model. The view is so simple and I added the table related with this view. Below T-SQL script about view.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER VIEW [dbo].[HFL_VWPrcListSrchRslt]
AS
  SELECT sfiyat_fiyati, 
         sfiyat_stokkod 
  FROM STOK_SATIS_FIYAT_LISTELERI 
  WHERE sfiyat_listesirano = 1 
    AND sfiyat_deposirano = 0 
    AND sfiyat_odemeplan <= 0

Why can't I see the View in my .edmx designer?

A: 

Such a view should be visible in the edmx designer - however, you have to add it explicitly, it doesn't just magically show up when you create it on the database.

So, a few things to check:

  • did you create the EDMX from scratch or did you use "Update Model from Database..." after you've created the view in the database?
  • are you connecting to the right database?
  • does the user that you use to connect to the database have permissions to see that view? E.g. can this user see the view and select from it in SQL Server Mgmt Studio?

Marc

marc_s
Thank you for your reply, marc_s. I have already checked them you said above. I last looked at .edmx file, it was a warning error about primary key related to this view. so I changed my view script as belowSELECT sfiyat_fiyati, sfiyat_stokkod, sfiyat_RECno.............this sfiyat_RECno is primary key in STOK_SATIS_FIYAT_LISTELERI table. Now I can add my view clearly. Thank you very much for your reply.
A: 

Hello , I deleted some views then I want to add them again but although I use "Update Model from Database..." , they didn't appears . Any help please..

Mandoleen
A: 

The solution : that happen because I deleted the entity from the designer but it is still at the XML so to solve it go to XML file , delete the entity definition and the entity mapping. May it helps

Mandoleen