VB.net multiple clause join
Maybe it's because it's late on a friday, but how I do I write the linq equivalent toSELECT * FROM CrewListAssignments INNER JOIN Jobs ON Jobs.JobId = CrewListAssignments.ContextID AND...
View ArticleChange SQL to Linq/ Lambda expression
Hi, I would like to join two tables in the MVC controller. How do i change the below SQL codes into a linq or lambda expression? I would like to get all the data column from User as Event and booking...
View ArticleImplement many_to_many relation with Entity Framework
I'vejust started Entity Frameworkprogramming.Idefinedthreeclassesin my program: User, Group and Permission.Each user canbea member ofseveral groups.In each group,several usercanbemember. Each group...
View ArticleForeach to image url
I have to get the Id from each of the images below and tie them to an image...having a little trouble.if (IsPostBack) { var qs = Request.QueryString["Id"];var images = from p in db.AdImages where...
View ArticleNested Select in LINQ using Lambda expression
I am sure this will be a super easy one for someone. I know sql but am not too familiar with lambda expressions.I would like to write a nested select where the results of the first select can be used...
View Articlesum between two values
Experts,How to get sum between these two values ?SELECT [Soldtopt], [tradingname], [DlvDate], SUM(try_cast(Netvalue as float)) as Netvalue, count(distinct SDDoc) as Salesdoc , count(distinct case when...
View ArticleHow to query this?
I want to query the following data and I stumble across an issue. I do want the type "StockData" to be returned in this method including the StockDataIndex value.First I tried this:StockData data =...
View ArticleSUM WHERE
Experts,I am trying to bring query which match following condition (where count(distinct SDDoc) = 1 and count(distinct case when Netvalue = '0' then 1 else null end) = 1) is it correct?my code isSELECT...
View ArticleSQL QUERY
Expert,I am getting following error, any idea?Msg 144, Level 15, State 1, Line 17 Cannot use an aggregate or a subquery in an expression used for the group by list of a GROUP BY clause. SELECT...
View ArticleCreating view from mentioned 2 tables
Hi,I have table 1 with the valuesLanguageIDNameCultureCode23E34F47-05F7-4C5D-AD41-00AEEF17B6B2Spanishes-ES7D2A52CE-FDF5-45AB-8D5C-00FACD0F34B2Greek -...
View ArticleDbContext
Hi I have below 2 classes and how they will be written in DbContextThanks public partial class AuthorViewModel { [Key] public int Id { get; set; } public string AuthorName { get; set; } public string...
View ArticleStored Procedure returns no columns, only integer
I have a problem with the entitry framework 6.0.0.0 when I import the stored procedure no matter what I do it does not return the result set, instead it returns only integer or set to none. below is...
View ArticleEntity Framework take about 30 second to do login ?
Hii have and MVC site with API, every thing works fine - i use Code First From Databasebut when i try login it's take about 30 second to do the login and i don't know why ??!!i use this code to login...
View ArticleBegineers Question on...
This may be a silly question but I don't get it. Maybe I am bringing bad habits in from other coding I have done.Take a simple set up like the below in the _layout.cshtml file <li><a...
View ArticleHow to add unique non primary-key field to entity using Entity Framework 5
Hi How to add unique non primary-key to Entity using Entity Framework 5Thanks
View ArticleTable Structure Question on EF
Okay, I am working through the tutorials and getting a bit confused by this.In SQL if I was setting a table up with a primary key and a couple of foreign keys I would probably add an index to the...
View ArticleDatabase First - Foreign Keys Not Showing up as Navigation Properties
Coding an MVC asp.net web application with an existing database (db first). My existing database has table tbluser with a foreign key idworker refrencing table tblworker primary key id.With the models...
View ArticleSQL query not working with the below code...Please help
I have the below stored procedure and C# code.Stored procedure:ALTER PROCEDURE [dbo].[ItemDetailsPicker] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT...
View ArticleChange SQL to Linq/ Lambda expression
Hi, I would like to join two tables in the MVC controller. How do i change the below SQL codes into a linq or lambda expression? I would like to get all the data column from User as Event and booking...
View ArticleCan someone provide example how to convert this sql statement to Linq to Sql
select c.GroupName , c.FormGroup from Category c, Roles r where r.EmployeeNumber = 931 and (c.FormGroup = r.RoleId ) or ( r.GroupView = c.GroupView ) Someone provide example how to convert this to Linq...
View Article