views:

20

answers:

0

Hi all,

Consider two tables, Product and Supplier. To get the required data for a grid view I need to do something like the following code snippet. SupplierID is a foreign key in the products table, but needs to be displayed in the user friendly SupplierName from the Supplier table.

SELECT Product.ProductID, Product.ProductName, Product.ProductPrice, Supplier.Name
FROM Product
INNER JOIN Supplier ON Product.SupplierId = Supplier.SupplierID

However to insert a new product, I'd have to do the following insert statement:

INSERT INTO Product(ProductName, ProductPrice, SupplierID)
VALUES (@productName, @productPrice, @supplierID)

Any idea how I could bind this to a datagrid given my EDM and also how I could enable CRUD operations on this while using the entity framework. Is this even possible? Sorry guys, this is my first time using the Entity Framework, I'm more used to writing SQL Queries for every operation I need to perform and executing them.