Click here to Skip to main content
15,885,365 members
Home / Discussions / Database
   

Database

 
GeneralRe: Joining 4 Tables in SQL Server Pin
Member 1154678321-Aug-15 23:14
Member 1154678321-Aug-15 23:14 
GeneralRe: Joining 4 Tables in SQL Server Pin
Mycroft Holmes22-Aug-15 1:09
professionalMycroft Holmes22-Aug-15 1:09 
GeneralRe: Joining 4 Tables in SQL Server Pin
Member 1154678323-Aug-15 4:25
Member 1154678323-Aug-15 4:25 
QuestionSSIS Error handling : Events vs control flow? Pin
Paddington Bear19-Aug-15 2:33
Paddington Bear19-Aug-15 2:33 
Questionsql linq, sum a column in a select new with Pin
jkirkerx16-Aug-15 12:39
professionaljkirkerx16-Aug-15 12:39 
AnswerRe: sql linq, sum a column in a select new with Pin
chairborne8217-Aug-15 1:46
chairborne8217-Aug-15 1:46 
GeneralRe: sql linq, sum a column in a select new with Pin
Mycroft Holmes17-Aug-15 2:42
professionalMycroft Holmes17-Aug-15 2:42 
AnswerRe: sql linq, sum a column in a select new with Pin
Jörgen Andersson17-Aug-15 3:01
professionalJörgen Andersson17-Aug-15 3:01 
GeneralRe: sql linq, sum a column in a select new with - Got the Sum part to work, need the Joins Pin
jkirkerx17-Aug-15 5:19
professionaljkirkerx17-Aug-15 5:19 
QuestionWPF/Entity Framework Design Time Exception Pin
Kevin Marois14-Aug-15 5:49
professionalKevin Marois14-Aug-15 5:49 
AnswerRe: WPF/Entity Framework Design Time Exception Pin
Jörgen Andersson15-Aug-15 6:51
professionalJörgen Andersson15-Aug-15 6:51 
QuestionDatabase Connectivity Problem Pin
Member 1190668913-Aug-15 1:20
Member 1190668913-Aug-15 1:20 
AnswerRe: Database Connectivity Problem Pin
Mycroft Holmes13-Aug-15 16:20
professionalMycroft Holmes13-Aug-15 16:20 
AnswerRe: Database Connectivity Problem Pin
Corporal Agarn14-Aug-15 0:40
professionalCorporal Agarn14-Aug-15 0:40 
QuestionUsing SQLite in C++ and C# Pin
Kevin Marois7-Aug-15 12:47
professionalKevin Marois7-Aug-15 12:47 
AnswerRe: Using SQLite in C++ and C# Pin
PIEBALDconsult7-Aug-15 14:04
mvePIEBALDconsult7-Aug-15 14:04 
QuestionSQL Transacation questions Pin
Tunisiano326-Aug-15 1:57
Tunisiano326-Aug-15 1:57 
AnswerRe: SQL Transacation questions Pin
Eddy Vluggen16-Aug-15 1:17
professionalEddy Vluggen16-Aug-15 1:17 
GeneralRe: SQL Transacation questions Pin
chairborne8217-Aug-15 17:12
chairborne8217-Aug-15 17:12 
QuestionSQL Linq, Row Number() Over, equiv in VB Pin
jkirkerx4-Aug-15 14:03
professionaljkirkerx4-Aug-15 14:03 
So I had someone help me write this years ago.

It's a Navigator fly out tab, in which if your working on a product in the editor, you can activate the tab, and the tab will populate with lets say 4 products before and 4 products after the selected product in the database table. This is so you don't have to go back to the index to load the next or previous product.

Since SQL Linq doesn't support the custom SQL Server Function, I need to think or create an alternative way to do this.

I guess I can create a List(Of with a blank column, and then go back and fill in the row numbers
get the row number of the item and ask for -3 and +3 of the row.

Just looking for some suggestions.

Here's the old TSQL
WITH CTE AS
(
 SELECT DISTINCT
  ProductID
, PostageImage
, PartNumber
, ShortDescription
, Price
, Thumbnail
, ActionThumbnail1
, ActionThumbnail2
, ActionThumbnail3
, FlatFee
, FlatFeeName
, VendorName
, ROW_NUMBER() OVER(ORDER BY PartNumber DESC) AS RowId
 FROM PRODUCTINFO p
), CTE1 AS (
 SELECT RowId FROM CTE WHERE PartNumber = @PartNumber
)
 SELECT * FROM CTE WHERE RowId BETWEEN (SELECT RowId-4 FROM CTE1) AND (SELECT RowId+3 FROM CTE1) ORDER BY PartNumber
This is what I was building in Linq Pad. It's pretty weak now, but I'm getting an idea of what I can do. But before I go off in some strange direction that will lead nowhere or be super slow, I thought I would just try and get a general consensus on this.

I tried to mark it as code but it gets chopped off, end of the day for me, going home now.

Dim p_partNumber as string = "06-SM4"
Dim context as new DBcontext

Dim ordersAsList = _
(
From pi in context.ProductInfo
Select pi
).ToList()

Dim orders = _
(
From pi in ordersAsList
take 3
Select
pi.ProductID
)

orders.Dump()
AnswerRe: SQL Linq, Row Number() Over, equiv in VB Pin
Richard Deeming5-Aug-15 1:41
mveRichard Deeming5-Aug-15 1:41 
GeneralRe: SQL Linq, Row Number() Over, equiv in VB Pin
jkirkerx5-Aug-15 6:09
professionaljkirkerx5-Aug-15 6:09 
GeneralRe: SQL Linq, Row Number() Over, equiv in VB Pin
jkirkerx5-Aug-15 7:58
professionaljkirkerx5-Aug-15 7:58 
GeneralRe: SQL Linq, Row Number() Over, equiv in VB Pin
Richard Deeming5-Aug-15 8:12
mveRichard Deeming5-Aug-15 8:12 
GeneralRe: SQL Linq, Row Number() Over, equiv in VB Pin
Richard Deeming5-Aug-15 8:18
mveRichard Deeming5-Aug-15 8:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.