Blog

My blog serves as a way for me to post solutions to problems I solve at work or during the long hours of freelance work.


Unable to update the EntitySet 'Categories' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

by Ezekiel 6. June 2012 14:34

 

I had to add a primary key to the database table I was trying to insert data into.

Tags: ,

LINQ to EntityFrame | SQL Server

C# LINQ Examples

by Ezekiel 6. April 2012 04:42

Tags: ,

C# | LINQ

C# Load DropDownList Data Using LINQ and Entity Framework

by Ezekiel 19. March 2012 02:50

 

        private void LoadDropDownList()
        {
            // Clear all items in drop down
            ddl.Items.Clear();

            using (Entities entities = new Entities())
            {
                var ddlValues = from s in entities.DBTableName
                                 select s;

                if (ddlValues != null)
                {
                    ddl.DataTextField = "TextFieldValue";
                    ddl.DataValueField = "Id";
                    ddl.DataSource = ddlValues.ToList();
                    ddl.DataBind();
                }
            }           
        }

Tags: , , ,

C# | LINQ to EntityFrame

RecentPosts