Posts

Showing posts with the label linq-to-sql

T-SQL to LINQ to SQL using Navigation Properties

Image
Clash Royale CLAN TAG #URR8PPP T-SQL to LINQ to SQL using Navigation Properties I can’t seem to come up with the right corresponding LINQ to SQL statement to generate the following T-SQL. Essentially, I'm trying to return payment information with only one of the customer's addresses... the AR address, if it exists, then the primary address, if it exists, then any address. SELECT < payment and address columns > FROM Payment AS p INNER JOIN Customer AS c ON c.CustomerID = p.CustomerID OUTER APPLY ( SELECT TOP 1 < address columns > FROM Address AS a WHERE a.person_id = c.PersonID ORDER BY CASE WHEN a.BusinessType = 'AR' THEN 0 ELSE 1 END , a.IsPrimary DESC END ) AS pa WHERE p.Posted = 1 We’re usin...

Add a table in .dbml file in Visual Studio 2017

Add a table in .dbml file in Visual Studio 2017 Adding a table in the .dbml file by drag and drop in Visual Studio 2017 community edition generates this error. Failed to retrieve data for this request. Failed to connect to server 10.1.2.3. Login failed for user 'user'. I am able to log in and view the tables and views in the SQL Server Object Explorer. NB: It was working on VS 2015 before updating. Adding SP still works. Windows authentication or user/password ? – schlonzo Apr 24 at 14:08 user/password. When I use Windows authentication, it's working, but I need to use user/password. – FLash Apr 25 at 5:18 Then it must be something with the authentication...