entitydatasource

How do I use EntityDatasource (Or LinqDatasource) with a Union clause

戏子无情 提交于 2020-01-17 08:03:11
问题 How do I combine records from two tables in an Entitydatasource control? I have googled it and searched on SO with no luck. The SQL of what I need is SELECT DISTINCT username FROM (SELECT s.username FROM project_stakeholders s UNION SELECT t.username FROM project_team_members t) My entities structure is as follows: project_stakeholders ---------------------- project_stakeholders.record_id (PK) project_stakeholders.username project_stakeholders.project project_stakeholders.project_id (FK)

How to pass DropDownList SelectedItem into the EntityDataSource Select Attribute

耗尽温柔 提交于 2020-01-16 09:35:10
问题 I am trying to pass the selected value of ddlCity dropdownlist into the EntityDataSource2 CommandText where "WHERE p.city = @city" but I get the following error: WhereParameters cannot be specified unless AutoGenerateWhere==true or Where is specified. <tr id="SearchDropDown"> <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=medicaldb2Entities" DefaultContainerName="medicaldb2Entities" EnableFlattening="False" EntitySetName="Medicals" Select="it.[medicalName],

Visual Studio 2013 and Entity Framework

此生再无相见时 提交于 2019-12-30 06:38:11
问题 I'm using VS 2013 and SQL Svr 2012 and trying use EF to populate a gridview. As this is a very simple test, I have just one table with a key and a couple of data fields. The process of creating the model seems to work fine - it shows as expected in the designer view, the files are created in app_code, a bin folder is created with 2 dlls, and the config file is updated with a connection string and other entries. When I try to select the "named connection" I get the error "Unable to load the

EntityDataSource OrderBy conflict

戏子无情 提交于 2019-12-24 01:43:13
问题 I'm using an EntityDataSource together with a RadGrid. I have issues with combining an EntityDataSource "OrderBy" together with a "Select Top" statement. <asp:EntityDataSource runat="server" ID="EntityDataSourceAlarm" ConnectionString="name=AlarmEntities" DefaultContainerName="AlarmEntities" EnableFlattening="False" EntitySetName="Alarms" OrderBy="it.Status ASC, it.TS DESC" Select="top(10) it.[OID], it.[TS], it.[Status]"> </asp:EntityDataSource> I want the order by clause to be applied before

asp.net entity framework <%# Bind(“linkedTable.Field”) %>

别说谁变了你拦得住时间么 提交于 2019-12-23 20:10:55
问题 .NET 4 ASP.NET I have a DetailsView that is displaying an entity framework record for a table that has a linked lookup table. I have an asp:BoundField with the datafield set as "linkedTable.Field" and it displays a value. <asp:BoundField DataField="linkedTable.Field" HeaderText="linkedTable.Field" SortExpression="linkedTable.Field" /> I am trying to use that value in an asp:TemplateField but when I try to get it using: <asp:TemplateField HeaderText="Field" SortExpression="linkedTable.Field" >

How to sort with a CASE statement in an EntityDataSource?

懵懂的女人 提交于 2019-12-21 21:32:59
问题 I'm using a CASE statement in my EntityDataSource to do custom sorting. Consider the following code: <asp:EntityDataSource ID="myEntityDataSource" runat="server" ConnectionString="name=MySQLEntities1" DefaultContainerName="MySQLEntities1" EnableFlattening="False" EntitySetName="Persons" EntityTypeFilter="Persons" OrderBy="it.[Pack], CASE it.[Type] WHEN 'MAN' THEN 1 WHEN 'VROUW' THEN 2 WHEN 'KIND' THEN 3 END, it.[BirthDate] ASC" /> In T-SQL this would be a perfecty normal way of sorting, but

Insert/Update/Delete is disabled for this control. message of EntityDataSource

…衆ロ難τιáo~ 提交于 2019-12-12 20:10:44
问题 I use ASPxGridView and EntityDataSource as its datasource. In EntityDataSource , I write CommandText, so I can not set "EnableInsert", "EnableUpdate", or "EnableDelete" to true. That's why, I manipulate (insert, update, delete) data manually. Changes are made manually pass through to database. But at the side of the GridView these errors are given: For inserting: "Insert is disabled for this control." For updating: "Update is disabled for this control." For deleting: "Delete is disabled for

How to add Count of child table in EntityDataSource

纵饮孤独 提交于 2019-12-11 13:42:01
问题 I have an EntityDataSource that works to get row data from tblOrderFile as follows: <asp:EntityDataSource ID="entityDataSourcePreorder" runat="server" ConnectionString="name=iDBEntities" DefaultContainerName="iDBEntities" EnableFlattening="False" EntitySetName="tblOrderFiles" Select="it.[pkOrderFileID], it.[fkOrderFileStatusID], it.[Filename], it.[CreateDate], it.[UserId]" AutoGenerateWhereClause="True" EntityTypeFilter="" Where=""> I would now like to modify it to also return back the number

The provider did not return a ProviderManifest instance

故事扮演 提交于 2019-12-11 12:33:21
问题 when I want to configure my Datasource (EntityDataSource1) and assign the connectionString that is generated automatically by entity data model to it. I get the error: "The metadata specified in the connection string could not be loaded. Consider rebuilding the web project to build assemblies that may contain metadata. The following error(s) occurred: The provider did not return a ProviderManifest instance". I read so many suggestions like http://blogs.teamb.com/craigstuntz/2010/08/13/38628/

EntityDataSource query inner join

眉间皱痕 提交于 2019-12-11 00:11:40
问题 I have a DB with 3 tables: User{UserId,UserName} Role{RoleId,RoleName} User_Role{UserId,RoleId} This query: int userIdPassByUrl = 0; MyDbContext ctx = new MyDbContext(); var query = (from role in ctx.Role join userRole in ctx.User_Role on role.RoleId equals userRole.RoleId where userRole.UserId == userIdPassByUrl select new { role.RoleId, role.RoleName }).Distinct(); I need to show the result of the above query in a Gridview with an EntityDataSource, either code or set it in the design mode.